mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
offer common youtube playlists as feed
This commit is contained in:
parent
d785fe4c5a
commit
7ef97ee6db
@ -1,6 +1,7 @@
|
|||||||
package scraper
|
package scraper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/nkanaev/yarr/src/content/htmlutil"
|
"github.com/nkanaev/yarr/src/content/htmlutil"
|
||||||
@ -35,6 +36,18 @@ func FindFeeds(body string, base string) map[string]string {
|
|||||||
link := htmlutil.AbsoluteUrl(href, base)
|
link := htmlutil.AbsoluteUrl(href, base)
|
||||||
if link != "" {
|
if link != "" {
|
||||||
candidates[link] = name
|
candidates[link] = name
|
||||||
|
|
||||||
|
l, err := url.Parse(link)
|
||||||
|
if err == nil && l.Host == "www.youtube.com" && l.Path == "/feeds/videos.xml" {
|
||||||
|
// https://wiki.archiveteam.org/index.php/YouTube/Technical_details#Playlists
|
||||||
|
channelID, found := strings.CutPrefix(l.Query().Get("channel_id"), "UC")
|
||||||
|
if found {
|
||||||
|
const url string = "https://www.youtube.com/feeds/videos.xml?playlist_id="
|
||||||
|
candidates[url + "UULF" + channelID] = name + " - Videos"
|
||||||
|
candidates[url + "UULV" + channelID] = name + " - Live Streams"
|
||||||
|
candidates[url + "UUSH" + channelID] = name + " - Short videos"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user