Created
July 21, 2023 20:38
-
-
Save Shourai/f8c144d57dd345df3d909d91c6b124b1 to your computer and use it in GitHub Desktop.
Convert YouTube takeout to newsboat RSS feed
This file contains hidden or 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
from zipfile import ZipFile | |
import csv | |
import os | |
def find_file(): | |
for file in os.listdir("./"): | |
if file.endswith(".zip"): | |
return file | |
# opening the zip file in READ mode | |
with ZipFile(str(find_file()), 'r') as zip: | |
# printing all the contents of the zip file | |
data = zip.read("Takeout/YouTube and YouTube Music/subscriptions/subscriptions.csv") | |
data = data.decode('utf-8').splitlines() | |
reader = csv.DictReader(data, delimiter=",") | |
with open('./yt_rss', 'w+') as rssfile: | |
for row in reader: | |
newsboat_str = f"https://www.youtube.com/feeds/videos.xml?channel_id={row['Channel Id']} \"~{row['Channel Title']}\"" | |
rssfile.write(newsboat_str + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After downloading the takeout zip file, put it and this python script in the same folder.
Run the python script to get the newsboat formatted rss file.