Closed NannoSilver closed 7 months ago
This issue is also present at pytube 15
I worked-out a solution with beautifulsoup to retrieve publish_date that can be used while there is no permanent fix:
import requests
from bs4 import BeautifulSoup
video_url = 'https://www.youtube.com/watch?v=4CPR6UK5svs'
response = requests.get(video_url)
soup = BeautifulSoup(response.text, 'html.parser')
publish_date = soup.find('meta', itemprop='datePublished')['content']
print(publish_date)
The publish_date is returning day, month and year only. Not returning time.
Code to test:
Expected result:
2023-12-26T13:30:09-08:00
Actual result:
2023-12-26 00:00:00
Published date seems to be available at the video's HTML page under a meta tag, as in this example: Video: https://www.youtube.com/watch?v=AW2LELZZNgA
<meta itemprop="datePublished" content="2023-12-26T13:30:09-08:00">
It also will be useful to have the option to have the output date in ISO format, that includes time-zone. The date in the meta tag already is in ISO format.