Advertisement
Griimnak

yt-dlp wrapper

Mar 30th, 2022
1,228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.31 KB | None | 0 0
  1. import os
  2. import time
  3.  
  4. print('''                      __       __   ___  
  5.                    /'__`\   /\ \ /\_ \
  6.   ___ ___   _____ /\_\_\ \  \_\ \\\//\ \
  7. /' __` __`\/\ '__`\/_/_\_\_  /'_` \ \ \ \
  8. /\ \/\ \/\ \ \ \_\ \/\ \_\ \/\ \_\ \ \_\ \_
  9. \ \_\ \_\ \_\ \ ,__/\ \____/\ \___,_\/\____\
  10.  \/_/\/_/\/_/\ \ \/  \/___/  \/__,_ /\/____/
  11.       mp3dl   \ \_\ youtube-dl wrapper script for
  12.                \/_/         mp3 conversion.
  13.                               github.com/griimnak
  14. ''')
  15.  
  16. mode = input('Choose mode: "music" or "video": ')
  17. url = None
  18.  
  19. if mode == 'video':
  20.     while True:
  21.         url = input('[viddl] Paste YouTube, Twitter, Tiktok, Anime or Bitchute video url: ')
  22.         os.system('yt-dlp --retries infinite --format "bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best" --merge-output-format mp4 "{}" --embed-thumbnail --postprocessor-args "-id3v2_version 3" -o videos/{}.%(ext)s'.format(url, time.time()))
  23.  
  24. elif mode == 'music':
  25.     while True:
  26.         url = input('[mp3dl] Paste YouTube or Soundcloud url: ')
  27.         os.system('yt-dlp --sleep-interval 1 -ciw --retries infinite -f bestaudio "{}" --extract-audio --audio-format mp3 --embed-thumbnail --postprocessor-args "-id3v2_version 3" -o music/%(title)s.%(ext)s'.format(url))
  28.  
  29. else:
  30.     exit('{} is not a valid mode, type "music" or "video"'.format(mode))
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement