Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' #420

Open
sayyid5416 opened this issue Jan 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@sayyid5416
Copy link
Contributor

🛑 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

Image


🖥️ Environment Details

Fill in the details below about your setup:

  • Operating System: Windows 11
  • Python Version: 3.12.1
  • Pytubefix Version: latest as of now
@sayyid5416 sayyid5416 added the bug Something isn't working label Jan 21, 2025
@NannoSilver
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants