test_pytube.py hinzugefügt

This commit is contained in:
2025-05-27 12:45:53 +00:00
parent 0ae078182b
commit 3172fa3e4d

24
test_pytube.py Normal file
View File

@@ -0,0 +1,24 @@
# test_pytube.py
from pytube import YouTube
import traceback
VIDEO_URL = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
print(f"Pytube Modulpfad: {YouTube.__file__}") # Hilft zu sehen, welche Pytube-Installation verwendet wird
print(f"Versuche, Infos für Video abzurufen: {VIDEO_URL}")
try:
yt = YouTube(VIDEO_URL)
print(f"Titel: {yt.title}")
print(f"Verfügbare Streams (Anzahl): {len(yt.streams)}")
stream = yt.streams.filter(progressive=True, file_extension='mp4').first()
if stream:
print(f"Erfolgreich einen progressiven MP4 Stream gefunden: {stream.itag}")
else:
print("Keinen progressiven MP4 Stream gefunden.")
except Exception as e:
print("\nEin Fehler ist aufgetreten:")
print(f"Fehlertyp: {type(e)}")
print(f"Fehlermeldung: {str(e)}")
print("Traceback:")
traceback.print_exc()