Skip to content

Instantly share code, notes, and snippets.

@Shourai
Created July 21, 2023 20:38
Show Gist options
  • Save Shourai/f8c144d57dd345df3d909d91c6b124b1 to your computer and use it in GitHub Desktop.
Save Shourai/f8c144d57dd345df3d909d91c6b124b1 to your computer and use it in GitHub Desktop.
Convert YouTube takeout to newsboat RSS feed
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')
@Shourai
Copy link
Author

Shourai commented Jul 21, 2023

  • Go to the Google takeout manager.
  • Log in if asked.
  • Click on "All YouTube data included", then on "Deselect all", then select only "subscriptions" and click "OK".
  • Click on "Next step" and then on "Create export".
  • Click on the "Download" button after it appears.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment