]> Skullheadx's Git Forge - youtube-downloader.git/commitdiff
stuff
authorSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Mon, 14 Oct 2024 05:07:00 +0000 (01:07 -0400)
committerSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Mon, 14 Oct 2024 05:07:00 +0000 (01:07 -0400)
Diamond is unbreakable - Main Theme.mp4 [deleted file]
ytdl.egg-info/SOURCES.txt
ytdl/__pycache__/__init__.cpython-312.pyc
ytdl/__pycache__/__main__.cpython-312.pyc
ytdl/__pycache__/funcmodule.cpython-312.pyc
ytdl/funcmodule.py

diff --git a/Diamond is unbreakable - Main Theme.mp4 b/Diamond is unbreakable - Main Theme.mp4
deleted file mode 100644 (file)
index e4e8445..0000000
Binary files a/Diamond is unbreakable - Main Theme.mp4 and /dev/null differ
index 11a7a883a1585dc0ab857b888bce9a55742acdfd..3a3b6f76230e23002ac5ea84dbf02e7bc1d10468 100644 (file)
@@ -3,9 +3,7 @@ README.md
 setup.py
 ytdl/__init__.py
 ytdl/__main__.py
-ytdl/classmodule.py
 ytdl/funcmodule.py
-ytdl/main.py
 ytdl.egg-info/PKG-INFO
 ytdl.egg-info/SOURCES.txt
 ytdl.egg-info/dependency_links.txt
index fdc5d88fac50b97f84f9a63268a53b4213e23a95..a2889eb188a9736c3babb84d0743b378dd882252 100644 (file)
Binary files a/ytdl/__pycache__/__init__.cpython-312.pyc and b/ytdl/__pycache__/__init__.cpython-312.pyc differ
index d52e7dab005d1ef6f3392acb9a87a73ac6fd6339..446f645b253662be92cb07d522982f0eee3aa86d 100644 (file)
Binary files a/ytdl/__pycache__/__main__.cpython-312.pyc and b/ytdl/__pycache__/__main__.cpython-312.pyc differ
index ad1302f4ccc45215acc9a404fc3d93fff06eac90..ca8b44a2d96b38f7a434c9bb262f6543bea4ec1e 100644 (file)
Binary files a/ytdl/__pycache__/funcmodule.cpython-312.pyc and b/ytdl/__pycache__/funcmodule.cpython-312.pyc differ
index 124283c73737a56511fe1ff8dd9844f4c18d33e7..bb45b47396a94a1053df1a8d43c73bad5deddd75 100644 (file)
@@ -1,8 +1,9 @@
-from pytubefix import YouTube, Playlist
-import requests
-import subprocess
-import os
 import glob
+import os
+import subprocess
+
+import requests
+from pytubefix import YouTube, Playlist
 
 
 def check_playlist(links):
@@ -31,40 +32,46 @@ def fix_filename(filename):
 
 def get_and_download(link):
     yt = YouTube(link)
-    if fix_filename(yt.title) + '.mp4' in glob.glob("*.mp4"):
-        print(f"{yt.title} is already downloaded")
-        return
-
-    yt.check_availability()
-    print(f"Fetching stream for {yt.title}")
-
-    assert len(yt.streams.filter(only_audio=True)) > 0, "No available audio streams"
-    audio_stream = yt.streams.filter(only_audio=True).order_by("abr").last()
-
-    print(f"Downloading audio stream for {yt.title}")
-    audio_stream.download(filename=fix_filename(audio_stream.default_filename), skip_existing=True)
+    # if fix_filename(yt.title) + '.mp4' in glob.glob("*.mp4"):
+    #     print(f"{yt.title} is already downloaded")
+    #     return
 
-    # create thumbnail file
-    data = requests.get(yt.thumbnail_url).content
-    thumbnail_filename = f'{fix_filename(audio_stream.title)}.jpg'
-    with open(thumbnail_filename, 'wb') as f:
-        f.write(data)
+    # yt.check_availability()
+    # print(f"Fetching stream for {yt.title}")
+    #
+    # assert len(yt.streams.filter(only_audio=True)) > 0, "No available audio streams"
+    # audio_stream = yt.streams.filter(only_audio=True).order_by("abr").last()
 
-    command = [
-        'ffmpeg',
-        '-i', fix_filename(audio_stream.default_filename),
-        '-i', thumbnail_filename,
-        '-map', '0',
-        '-map', '1',
-        '-metadata', f'title={fix_filename(audio_stream.title)}',
-        '-metadata', f'artist={yt.author}',
-        '-metadata', f'date={yt.publish_date}',
-        '-metadata', f'comment={big_num_format(yt.views) + " views"}',
-        fix_filename(audio_stream.title) + ".mp4",
-        '-n'
-    ]
-    subprocess.run(command)
 
-    # clean up tmp files
-    os.remove(thumbnail_filename)
-    os.remove(fix_filename(audio_stream.default_filename))
+    # hierarchy:
+    caption_hierarchy = ["ko", "ja", "zh", "en", "a.ko", "a.en"]
+    if len(yt.captions) > 0:
+        for caption in yt.captions:
+            print(yt.title, caption.lang_code)
+    # print(f"Downloading audio stream for {yt.title}")
+    # audio_stream.download(filename=fix_filename(audio_stream.default_filename), skip_existing=True)
+    #
+    # # create thumbnail file
+    # data = requests.get(yt.thumbnail_url).content
+    # thumbnail_filename = f'{fix_filename(audio_stream.title)}.jpg'
+    # with open(thumbnail_filename, 'wb') as f:
+    #     f.write(data)
+    #
+    # command = [
+    #     'ffmpeg',
+    #     '-i', fix_filename(audio_stream.default_filename),
+    #     '-i', thumbnail_filename,
+    #     '-map', '0',
+    #     '-map', '1',
+    #     '-metadata', f'title={fix_filename(audio_stream.title)}',
+    #     '-metadata', f'artist={yt.author}',
+    #     '-metadata', f'date={yt.publish_date}',
+    #     '-metadata', f'comment={big_num_format(yt.views) + " views"}',
+    #     fix_filename(audio_stream.title) + ".mp4",
+    #     '-y'
+    # ]
+    # subprocess.run(command)
+    #
+    # # clean up tmp files
+    # os.remove(thumbnail_filename)
+    # os.remove(fix_filename(audio_stream.default_filename))