From 97ca03cb5d9d4bd9c0e14eef0ca296c649afaaec Mon Sep 17 00:00:00 2001 From: Aurelien David Date: Thu, 9 Jul 2020 20:24:01 +0200 Subject: [PATCH] regexp named groups aren't supported until ff 78 (#56) --- manifest.json | 2 +- rsspreview.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index bb698ed..463eb7d 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/rsspreview.js b/rsspreview.js index a30cf5b..35b146b 100644 --- a/rsspreview.js +++ b/rsspreview.js @@ -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\/(?[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;