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
Issues with incomplete or missing information will be closed automatically.
🐞 Bug Description
Provide a clear and concise description of the bug.
The int() function raises a TypeError when the views attribute in the YouTube class from pytubefix is None. This happens despite the attribute being present, as sometimes YouTube's videoDetails API returns None for the viewCount field.
Include the minimal code snippet that reproduces the issue.
frompytubefiximportYouTubeyt=YouTube('https://www.youtube.com/watch?v=example')
try:
views=int(yt.views) # The error occurs here if yt.views is NoneexceptTypeErrorase:
print(f"TypeError: {e}")
🎯 Expected Behavior
Describe what you expected to happen instead of the observed behavior.
The views attribute should either provide a default value (e.g., 0) or handle cases where the value is None. Ideally, the library should ensure that views is always compatible with the int() function to prevent such errors.
Add any additional information or context that might help us resolve the issue.
This issue might be due to inadequate validation of the videoDetails API response. Specifically, when the viewCount field is missing or set to None, it causes the error. A potential solution would be to add a fallback value (e.g., 0) to the views property in the pytubefix library.
🚀 Next Steps
Once submitted, we will triage the issue. Make sure to respond to follow-up questions to keep the process smooth.
This report contains all necessary information to reproduce the issue. Please let me know if further details are required. Thank you for your support!
The text was updated successfully, but these errors were encountered:
🛑 DO NOT REMOVE OR SKIP THIS ISSUE TEMPLATE 🛑
Issues with incomplete or missing information will be closed automatically.
🐞 Bug Description
Provide a clear and concise description of the bug.
The int() function raises a TypeError when the views attribute in the YouTube class from pytubefix is None. This happens despite the attribute being present, as sometimes YouTube's videoDetails API returns None for the viewCount field.
🔢 Code Snippet
Include the minimal code snippet that reproduces the issue.
🎯 Expected Behavior
Describe what you expected to happen instead of the observed behavior.
The views attribute should either provide a default value (e.g., 0) or handle cases where the value is None. Ideally, the library should ensure that views is always compatible with the int() function to prevent such errors.
📸 Screenshots or Logs
🖥️ Environment Details
Fill in the details below about your setup:
📋 Additional Context
Add any additional information or context that might help us resolve the issue.
This issue might be due to inadequate validation of the videoDetails API response. Specifically, when the viewCount field is missing or set to None, it causes the error. A potential solution would be to add a fallback value (e.g., 0) to the views property in the pytubefix library.
🚀 Next Steps
Once submitted, we will triage the issue. Make sure to respond to follow-up questions to keep the process smooth.
This report contains all necessary information to reproduce the issue. Please let me know if further details are required. Thank you for your support!
The text was updated successfully, but these errors were encountered: