commit c00a73322473bc9ab73201e99ab87fe8a05c126c
parent 00080cadc91ee12ab0f4b205a5a26f7a85f14403
Author: Paco Esteban <paco@e1e0.net>
Date: Fri, 31 Jul 2020 20:23:39 +0200
add youtube example urls and parse also `/user` type
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/README b/README
@@ -7,9 +7,10 @@ For now it can:
* subscribe to feed
* subscribe to feed of a Youtube channel automatically, given an url of
the form:
- *
- *
- *
+ * https://www.youtube.com/watch?v=xxxxxxxxxxx
+ * https://www.youtube.com/channel/xxxxxxxxxxxxxxxxxxxxxxxx
+ * https://www.youtube.com/c/xxxxxxxxxx
+ * https://www.youtube.com/user/xxxxxxxxxx
* unsubscribe from feed.
Build:
diff --git a/pkg/ttrss/ttrss.go b/pkg/ttrss/ttrss.go
@@ -269,7 +269,7 @@ func (c *Client) SubscribeYoutube(category int, url string) (int, error) {
channelId = match[1]
}
- re = regexp.MustCompile(`https://.*\.youtube\.com\/c\/.*`)
+ re = regexp.MustCompile(`https://.*\.youtube\.com\/(c|user)\/.*`)
if len(re.FindString(url)) > 0 {
// call the youtube url
resp, err := http.Get(url)