Skip to content

Instantly share code, notes, and snippets.

@emsi
Created August 10, 2021 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emsi/a7820e6a5d12116b6766c348f73e144c to your computer and use it in GitHub Desktop.
Save emsi/a7820e6a5d12116b6766c348f73e144c to your computer and use it in GitHub Desktop.
Pyto youtube downloader
# Download audio/video file using youtube_dl
# to a folder picked on first run (using bookmarks).
# Make sure to start it with "--fixup never".
# For exampe to download just original audio use
# Pyto Run Script with following arguments:
# -f 140 --fixup never $URL
from youtube_dl import main
import bookmarks
import background as bg
import os
import uuid
music = bookmarks.FolderBookmark("music")
os.chdir(music.path)
# use random task id so we can have multiple background downloads
with bg.BackgroundTask(None, str(uuid.uuid4())) as b:
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment