From 4bedf554610191065f374492ab261260d9d5492a Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 12 Aug 2020 14:40:47 -0700 Subject: yt_data_extract: Fix time_published picking up 'Streaming' string This was causing an exception in subscriptions when it tried to estimate the unix timestamp for the upload time --- youtube/yt_data_extract/common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'youtube/yt_data_extract') diff --git a/youtube/yt_data_extract/common.py b/youtube/yt_data_extract/common.py index dd02f2e..2d3b637 100644 --- a/youtube/yt_data_extract/common.py +++ b/youtube/yt_data_extract/common.py @@ -253,7 +253,11 @@ def extract_item_info(item, additional_info={}): info['badges'].append(badge) if primary_type in ('video', 'playlist'): - info['time_published'] = extract_str(item.get('publishedTimeText')) + info['time_published'] = None + timestamp = re.search(r'(\d+ \w+ ago)', + extract_str(item.get('publishedTimeText'), default='')) + if timestamp: + info['time_published'] = timestamp.group(1) if primary_type == 'video': info['id'] = item.get('videoId') -- cgit v1.2.3