aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-08-12 14:40:47 -0700
committerJames Taylor <user234683@users.noreply.github.com>2020-08-12 14:40:47 -0700
commit4bedf554610191065f374492ab261260d9d5492a (patch)
treedcbec616445909f804e06282fb95fbed838d884d /youtube/yt_data_extract
parent3a07a87c88b27c5e7e06ee7d67cd6095272e9159 (diff)
downloadyt-local-4bedf554610191065f374492ab261260d9d5492a.tar.lz
yt-local-4bedf554610191065f374492ab261260d9d5492a.tar.xz
yt-local-4bedf554610191065f374492ab261260d9d5492a.zip
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
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r--youtube/yt_data_extract/common.py6
1 files changed, 5 insertions, 1 deletions
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')