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
This commit is contained in:
James Taylor 2020-08-12 14:40:47 -07:00
parent 3a07a87c88
commit 4bedf55461

View File

@ -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')