youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit 7efc1c2b493aa1d68e5f1b248980144bbacf943a
parent 132e3b74bdcb73ccacbfeecdae5713dd65829af9
Author: Yen Chi Hsuan <yan12125@gmail.com>
Date:   Sun, 21 Feb 2016 17:29:28 +0800

[twitter] Fix metadata extraction and test_Twitter_1

Diffstat:
Myoutube_dl/extractor/twitter.py | 19++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/youtube_dl/extractor/twitter.py b/youtube_dl/extractor/twitter.py @@ -165,6 +165,7 @@ class TwitterIE(InfoExtractor): 'uploader': 'Gifs', 'uploader_id': 'giphz', }, + 'expected_warnings': ['height', 'width'], }, { 'url': 'https://twitter.com/starwars/status/665052190608723968', 'md5': '39b7199856dee6cd4432e72c74bc69d4', @@ -212,20 +213,24 @@ class TwitterIE(InfoExtractor): return info mobj = re.search(r'''(?x) - <video[^>]+class="animated-gif"[^>]+ - (?:data-height="(?P<height>\d+)")?[^>]+ - (?:data-width="(?P<width>\d+)")?[^>]+ - (?:poster="(?P<poster>[^"]+)")?[^>]*>\s* + <video[^>]+class="animated-gif"(?P<more_info>[^>]+)>\s* <source[^>]+video-src="(?P<url>[^"]+)" ''', webpage) if mobj: + more_info = mobj.group('more_info') + height = int_or_none(self._search_regex( + r'data-height="(\d+)"', more_info, 'height', fatal=False)) + width = int_or_none(self._search_regex( + r'data-width="(\d+)"', more_info, 'width', fatal=False)) + thumbnail = self._search_regex( + r'poster="([^"]+)"', more_info, 'poster', fatal=False) info.update({ 'id': twid, 'url': mobj.group('url'), - 'height': int_or_none(mobj.group('height')), - 'width': int_or_none(mobj.group('width')), - 'thumbnail': mobj.group('poster'), + 'height': height, + 'width': width, + 'thumbnail': thumbnail, }) return info