aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube/yt_data_extract/common.py')
-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')