Last active
August 12, 2022 16:26
-
-
Save kevinfiol/da63cd137327b8f8d6b70706017320ef to your computer and use it in GitHub Desktop.
a crappy script to get RSS feeds from your channel subscriptions at https://www.youtube.com/feed/channels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name get feeds | |
// @namespace Violentmonkey Scripts | |
// @match https://www.youtube.com/feed/channels | |
// @grant none | |
// @version 1.0 | |
// @author - | |
// @description 8/9/2022, 11:24:20 PM | |
// ==/UserScript== | |
// probably a really fragile script to export youtube subscriptions as individual RSS feeds | |
let feeds = ytInitialData | |
.contents | |
.twoColumnBrowseResultsRenderer | |
.tabs[0] | |
.tabRenderer | |
.content | |
.sectionListRenderer | |
.contents[0] | |
.itemSectionRenderer | |
.contents[0] | |
.shelfRenderer | |
.content | |
.expandedShelfContentsRenderer | |
.items | |
.map(channel => { | |
return [ | |
channel.channelRenderer.title.simpleText, | |
`https://www.youtube.com/feeds/videos.xml?channel_id=${channel.channelRenderer.channelId}` | |
]; | |
}); | |
let downloadBtn = document.createElement('button'); | |
downloadBtn.innerText = 'get feeds'; | |
downloadBtn.addEventListener('click', () => { | |
download('feeds.json', JSON.stringify(feeds, null, 2)); | |
}); | |
window.onload = () => { | |
setTimeout(() => { | |
document.getElementById('contents').prepend(downloadBtn); | |
}, 2500); | |
}; | |
function download(filename, text) { | |
let element = document.createElement('a'); | |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
element.setAttribute('download', filename); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); | |
document.body.removeChild(element); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment