You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing some similar problems to retrieve duration. The error do not happens always.
Here is a code with some videos that were generating the error a few hours ago. Now some of them are retrieving the duration properly, but others remain failing:
import sys
from pytubefix import YouTube
list = ['https://www.youtube.com/watch?v=Uvjkb27JNuo', 'https://www.youtube.com/watch?v=ojYj-kFgwyU', 'https://www.youtube.com/watch?v=5J0yEnJ4B1o', 'https://www.youtube.com/watch?v=n95Cqx5V4rQ', 'https://www.youtube.com/watch?v=F6ayhSvu9Rk', 'https://www.youtube.com/watch?v=PSPb2AAl4O0', 'https://www.youtube.com/watch?v=sTzkmEmUPIc', 'https://www.youtube.com/watch?v=O0PRQamYAZk', 'https://www.youtube.com/watch?v=Uvjkb27JNuo', 'https://www.youtube.com/watch?v=lC90fuY-xz0']
for url in list:
try:
yt = YouTube(url)
print(yt.length)
except:
error_type, e, error_traceback = sys.exc_info()
print(f'Failed with Error: {e}')
Output:
211
212
120
Failed with Error: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Failed with Error: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Failed with Error: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
2342
774
211
Failed with Error: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Process finished with exit code 0
🛑 DO NOT REMOVE OR SKIP THIS ISSUE TEMPLATE 🛑
Issues with incomplete or missing information will be closed automatically.
🐞 Bug Description
TypeError is happening
🔢 Code Snippet
Try to call
YouTube.views
for any video. I called on https://www.youtube.com/watch?v=kJQP7kiw5Fk🎯 Expected Behavior
should've returned view count
📸 Screenshots or Logs
🖥️ Environment Details
Fill in the details below about your setup:
The text was updated successfully, but these errors were encountered: