Merhabalar,
ben pytube kullanarak şöyle bir program yazdım:
from pytube import YouTube
yt = 0
while True:
val = input('>>>')
if val == "video --input --url":
yts = input("url >>>")
yt = YouTube(yts)
if val == "video --title":
if yt != 0:
print(f"Video Title: {yt.title}")
if val == "video --author":
if yt != 0:
print(f"Video Author: {yt.author}")
if val == "video --thumbnail":
if yt != 0:
print(f"Thumbnail Picture: {yt.thumbnail_url}")
if val == "video --length":
if yt != 0:
print(f"Video length: {yt.length}")
if val == "video --rating":
if yt != 0:
print(f"Video Rating: {yt.rating}")
if val == "video --views":
if yt != 0:
print(f"Video Views: {yt.views}")
if val == "video --title":
if yt != 0:
print(f"""Video Description:
{yt.description}""")
if val == "video --download":
if yt != 0:
stream = yt.streams.filter(progressive=True).first()
stream.download()
if val == "video --subtitle":
if yt != 0:
for i in yt.captions:
print(i)
lg = input("language >>>")
caption = yt.captions[lg]
cc = caption.generate_srt_captions()
print(cc)
Fakat şöyle bir hata verdi
>>>video --input --url
url >>>https://www.youtube.com/watch?v=DyDfgMOUjCI
Traceback (most recent call last):
File "C:\Users\****\Desktop\*****\yazılım\py\uygulama\yt\yt.py", line 9, in
yt = YouTube(yts)
File "C:\Users\****\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytube\__main__.py", line 91, in __init__
self.prefetch()
File "C:\Users\****\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytube\__main__.py", line 183, in prefetch
self.js_url = extract.js_url(self.watch_html)
File "C:\Users\****\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytube\extract.py", line 143, in js_url
base_js = get_ytplayer_config(html)["assets"]["js"]
File "C:\Users\****\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytube\extract.py", line 202, in get_ytplayer_config
raise RegexMatchError(caller="get_ytplayer_config", pattern="config_patterns")
pytube.exceptions.RegexMatchError: get_ytplayer_config: could not find match for config_patterns
Hata ayıklama yaptım düzgün ama bbu hatayı verdi sebebi nedir ? (pip ile pytube yi içe aktardım).