diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-08-12 14:40:47 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-08-12 14:40:47 -0700 |
commit | 4bedf554610191065f374492ab261260d9d5492a (patch) | |
tree | dcbec616445909f804e06282fb95fbed838d884d /youtube | |
parent | 3a07a87c88b27c5e7e06ee7d67cd6095272e9159 (diff) | |
download | yt-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')
-rw-r--r-- | youtube/yt_data_extract/common.py | 6 |
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') |