test_pytube.py aktualisiert
This commit is contained in:
@@ -1,14 +1,21 @@
|
|||||||
# test_pytube.py
|
|
||||||
from pytube import YouTube
|
from pytube import YouTube
|
||||||
import traceback
|
import traceback
|
||||||
|
import sys # Importiere sys für den Modulzugriff
|
||||||
|
|
||||||
VIDEO_URL = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
|
VIDEO_URL = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' # Oder eine andere Test-URL
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Versuche, den Pfad des pytube-Moduls auszugeben
|
||||||
|
pytube_module = sys.modules[YouTube.__module__]
|
||||||
|
print(f"Pytube Modulpfad: {pytube_module.__file__}")
|
||||||
|
except Exception as e_path:
|
||||||
|
print(f"Konnte Pytube Modulpfad nicht ermitteln: {e_path}")
|
||||||
|
|
||||||
print(f"Pytube Modulpfad: {YouTube.__file__}") # Hilft zu sehen, welche Pytube-Installation verwendet wird
|
|
||||||
print(f"Versuche, Infos für Video abzurufen: {VIDEO_URL}")
|
print(f"Versuche, Infos für Video abzurufen: {VIDEO_URL}")
|
||||||
try:
|
try:
|
||||||
yt = YouTube(VIDEO_URL)
|
yt = YouTube(VIDEO_URL)
|
||||||
print(f"Titel: {yt.title}")
|
print(f"Titel: {yt.title}")
|
||||||
|
# Dieser Aufruf ist oft der kritische Punkt, der den Fehler auslöst
|
||||||
print(f"Verfügbare Streams (Anzahl): {len(yt.streams)}")
|
print(f"Verfügbare Streams (Anzahl): {len(yt.streams)}")
|
||||||
stream = yt.streams.filter(progressive=True, file_extension='mp4').first()
|
stream = yt.streams.filter(progressive=True, file_extension='mp4').first()
|
||||||
if stream:
|
if stream:
|
||||||
@@ -17,7 +24,7 @@ try:
|
|||||||
print("Keinen progressiven MP4 Stream gefunden.")
|
print("Keinen progressiven MP4 Stream gefunden.")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("\nEin Fehler ist aufgetreten:")
|
print("\nEin Fehler ist aufgetreten im Haupt-Try-Block:")
|
||||||
print(f"Fehlertyp: {type(e)}")
|
print(f"Fehlertyp: {type(e)}")
|
||||||
print(f"Fehlermeldung: {str(e)}")
|
print(f"Fehlermeldung: {str(e)}")
|
||||||
print("Traceback:")
|
print("Traceback:")
|
||||||
|
|||||||
Reference in New Issue
Block a user