From e9c6deffee26db40992293b3055df31804ca7e12 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Wed, 22 Jul 2015 23:22:19 +0800 Subject: [PATCH] [lecture2go] Add more metadata fields --- youtube_dl/extractor/lecture2go.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/lecture2go.py b/youtube_dl/extractor/lecture2go.py index d0e9416f5..a2f9d5c54 100644 --- a/youtube_dl/extractor/lecture2go.py +++ b/youtube_dl/extractor/lecture2go.py @@ -4,7 +4,11 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..utils import determine_ext +from ..utils import ( + determine_ext, + parse_duration, + int_or_none, +) class Lecture2GoIE(InfoExtractor): @@ -17,6 +21,7 @@ class Lecture2GoIE(InfoExtractor): 'ext': 'flv', 'title': '2 - Endliche Automaten und reguläre Sprachen', 'creator': 'Frank Heitmann', + 'duration': 5220, } } @@ -41,10 +46,16 @@ class Lecture2GoIE(InfoExtractor): self._sort_formats(formats) creator = self._html_search_regex(r']+id="description">([^<]+)', webpage, 'creator') + duration = parse_duration(self._html_search_regex( + r'Duration:\s*\s*]*>([^<]+)', webpage, 'duration', fatal=False)) + view_count = int_or_none(self._html_search_regex( + r'Views:\s*\s*]+>(\d+)', webpage, 'view count', fatal=False)) return { 'id': video_id, 'title': title, 'formats': formats, - 'creator': creator + 'creator': creator, + 'duration': duration, + 'view_count': view_count, }