mirror of
https://github.com/aureliendavid/rsspreview.git
synced 2025-08-22 19:28:39 +00:00
regexp named groups aren't supported until ff 78 (#56)
This commit is contained in:
parent
10790dfede
commit
97ca03cb5d
@ -2,7 +2,7 @@
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "RSSPreview",
|
||||
"version": "3.13",
|
||||
"version": "3.13.1",
|
||||
"author": "Aurelien David",
|
||||
"homepage_url": "https://github.com/aureliendavid/rsspreview",
|
||||
|
||||
|
@ -382,13 +382,13 @@
|
||||
// YouTube's canonical channel URLs look like /channel/AlphaNumericID
|
||||
// It also supports named channels of the form /c/MyChannelName
|
||||
// Match on both of these to autodetect channel feeds on either URL
|
||||
let idPattern = /channel\/(?<channelId>[a-zA-Z0-9_-]+)/;
|
||||
let idPattern = /channel\/([a-zA-Z0-9_-]+)/;
|
||||
let namePattern = /(?:c|user)\/[a-zA-Z0-9_-]+/;
|
||||
let urlPattern = new RegExp(`${idPattern.source}|${namePattern.source}`);
|
||||
if (document.URL.match(urlPattern)) {
|
||||
let feeds = {};
|
||||
let canonicalUrl = document.querySelector("link[rel='canonical']").href;
|
||||
let channelId = canonicalUrl.match(idPattern).groups.channelId;
|
||||
let channelId = canonicalUrl.match(idPattern)[1];
|
||||
let url = `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}`;
|
||||
let title = document.title;
|
||||
feeds[url] = title;
|
||||
|
Loading…
Reference in New Issue
Block a user