mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 19:57:48 +00:00
Add packages to poetry
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import subprocess
|
||||
import json
|
||||
import redis
|
||||
from yt_dlp import YoutubeDL
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
raise Exception("Expected path to file as argument")
|
||||
|
||||
config_path = sys.argv[1]
|
||||
|
||||
config = json.load(open("config.json", "r", encoding="utf-8"))
|
||||
redis_prefix = config["redis_prefix"]
|
||||
redis_client = redis.from_url(config["redis_url"])
|
||||
|
||||
file = open(config_path, "r")
|
||||
|
||||
youtube_dl_opts = {}
|
||||
|
||||
vid_urls = subprocess.run(["yt-dlp", "--print", "id", "https://www.youtube.com/playlist?list=PLM2V-zC1RStc1TttVrVXCTQ5AW_jN0fFS"], capture_output=True).stdout.decode("utf-8")
|
||||
|
||||
for vid_url in vid_urls.split("\n"):
|
||||
if vid_url == "":
|
||||
continue
|
||||
vid_url = "https://www.youtube.com/watch?v=" + vid_url
|
||||
redis_client.sadd(f"{redis_prefix}:playlist", vid_url)
|
||||
print(vid_url)
|
||||
|
||||
Reference in New Issue
Block a user