aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youtube.py
diff options
context:
space:
mode:
authorDario Guarascio <dario@pink.esync.lan>2014-05-15 13:59:27 +0700
committerDario Guarascio <dario@pink.esync.lan>2014-05-15 13:59:27 +0700
commitec8deefc275c2f7ddbbd9e78397f2e202c4a621f (patch)
treec4b2f9111721d6ed34f8a7b300e0e62b264e2e71 /youtube_dl/extractor/youtube.py
parenta2d5a4ee64926c82d0f7d29aebd7654044a61f89 (diff)
[youtube] Video categories added to metadata
Diffstat (limited to 'youtube_dl/extractor/youtube.py')
-rw-r--r--youtube_dl/extractor/youtube.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 1f3aa4322..f0a92d182 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1141,6 +1141,14 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
upload_date = ' '.join(re.sub(r'[/,-]', r' ', mobj.group(1)).split())
upload_date = unified_strdate(upload_date)
+
+ video_categories = []
+ # categories
+ m_cat_container = get_element_by_id("eow-category", video_webpage)
+ if m_cat_container:
+ video_categories = re.findall(r'<a[^<]+>(.*?)</a>',
+ m_cat_container, re.DOTALL)
+
# description
video_description = get_element_by_id("eow-description", video_webpage)
if video_description:
@@ -1347,6 +1355,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
'title': video_title,
'thumbnail': video_thumbnail,
'description': video_description,
+ 'categories': video_categories,
'subtitles': video_subtitles,
'duration': video_duration,
'age_limit': 18 if age_gate else 0,