JuanBindez/pytubefix

Method Error

Closed this issue · 3 comments

Describe the bug
When upgrading to any version beyond 2.0.0, I get a method error for publish_date

To Reproduce
pip install --upgrade pytubefix
run code
get error about yt.publish_date not having a method strftime()

pip uninstall pytubefix
pip install 'pytubefix==2.0.0'
run code
no error

Expected behavior
I would expect the method to not fail

Screenshots
https://imgur.com/a/hl7WrIk

Desktop (please complete the following information):

  • OS: Red Hat Enterprise Linux release 9.3 (Plow)
  • Python Version 3.11.5
  • Pytubefix Version 2.0.0 // 3.0.0

try

from pytubefix import YouTube

video_url = 'https://www.youtube.com/watch?v=jDwVkXVHIqg&t=25s'

yt = YouTube (video_url)

publish_date = yt.publish_date
print(publish_date)

Here it worked perfectly, it is normal for some videos to not have the date and time available.

The issue was in extract.py. It was not returning a datetime object. I submitted a PR to fix that.
version 2.0.0 was returning a datetime object

#52