From 4f879a5be0813ae2c0d756ad52608125117fef58 Mon Sep 17 00:00:00 2001 From: z00nx 0 Date: Thu, 30 Jan 2014 20:44:53 +1100 Subject: [PATCH 1/3] [bliptv] Filter out SRT files --- youtube_dl/extractor/bliptv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/bliptv.py b/youtube_dl/extractor/bliptv.py index 3ce9b5324..ffe6f89b1 100644 --- a/youtube_dl/extractor/bliptv.py +++ b/youtube_dl/extractor/bliptv.py @@ -78,8 +78,8 @@ class BlipTVIE(InfoExtractor): upload_date = datetime.datetime.strptime(data['datestamp'], '%m-%d-%y %H:%M%p').strftime('%Y%m%d') formats = [] if 'additionalMedia' in data: - for f in sorted(data['additionalMedia'], key=lambda f: int(f['media_height'])): - if not int(f['media_width']): # filter m3u8 + for f in sorted(data['additionalMedia'], key=lambda f: int(0 if f['media_height'] is None else f['media_height'])): + if not int(0 if f['media_height'] is None else f['media_height']): # filter out m3u8 and srt files continue formats.append({ 'url': f['url'], From dbe80ca7adabb23f91fbd1aaaf1151af3942eb26 Mon Sep 17 00:00:00 2001 From: "Sergey M." Date: Mon, 3 Feb 2014 01:20:03 +0700 Subject: [PATCH 2/3] [tinypic] Add support for tinypic.com videos (Closes #2210) --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/tinypic.py | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 youtube_dl/extractor/tinypic.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 9b346ac68..073f3a0d1 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -200,6 +200,7 @@ from .ted import TEDIE from .tf1 import TF1IE from .theplatform import ThePlatformIE from .thisav import ThisAVIE +from .tinypic import TinyPicIE from .toutv import TouTvIE from .traileraddict import TrailerAddictIE from .trilulilu import TriluliluIE diff --git a/youtube_dl/extractor/tinypic.py b/youtube_dl/extractor/tinypic.py new file mode 100644 index 000000000..2246d27b2 --- /dev/null +++ b/youtube_dl/extractor/tinypic.py @@ -0,0 +1,50 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from youtube_dl.utils import ExtractorError + + +class TinyPicIE(InfoExtractor): + IE_NAME = 'tinypic' + IE_DESC = 'tinypic.com videos' + _VALID_URL = r'http://tinypic\.com/player\.php\?v=(?P[^&]+)&s=\d+' + + _TEST = { + 'url': 'http://tinypic.com/player.php?v=6xw7tc%3E&s=5#.UtqZmbRFCM8', + 'md5': '609b74432465364e72727ebc6203f044', + 'info_dict': { + 'id': '6xw7tc', + 'ext': 'flv', + 'title': 'shadow phenomenon weird', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id, 'Downloading page') + + mobj = re.search(r'(?m)fo\.addVariable\("file",\s"(?P[\da-z]+)"\);\n' + '\s+fo\.addVariable\("s",\s"(?P\d+)"\);', webpage) + if mobj is None: + raise ExtractorError('Video %s does not exist' % video_id, expected=True) + + file_id = mobj.group('fileid') + server_id = mobj.group('serverid') + + KEYWORDS_SUFFIX = ', Video, images, photos, videos, myspace, ebay, video hosting, photo hosting' + keywords = self._html_search_meta('keywords', webpage, 'title') + title = keywords[:-len(KEYWORDS_SUFFIX)] if keywords.endswith(KEYWORDS_SUFFIX) else '' + + video_url = 'http://v%s.tinypic.com/%s.flv' % (server_id, file_id) + thumbnail = 'http://v%s.tinypic.com/%s_th.jpg' % (server_id, file_id) + + return { + 'id': file_id, + 'url': video_url, + 'thumbnail': thumbnail, + 'title': title + } \ No newline at end of file From 2b39af9b4f8cea51f11fbec726aca0482b671256 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Mon, 3 Feb 2014 02:41:59 +0100 Subject: [PATCH 3/3] [BlipTV] Add a test case w/ subtitles (#2274) --- youtube_dl/extractor/bliptv.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/bliptv.py b/youtube_dl/extractor/bliptv.py index ffe6f89b1..9ca9f6525 100644 --- a/youtube_dl/extractor/bliptv.py +++ b/youtube_dl/extractor/bliptv.py @@ -22,17 +22,30 @@ class BlipTVIE(InfoExtractor): _VALID_URL = r'^(?:https?://)?(?:\w+\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(.+)$' - _TEST = { + _TESTS = [{ 'url': 'http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352', - 'file': '5779306.mov', 'md5': 'c6934ad0b6acf2bd920720ec888eb812', 'info_dict': { + 'id': '5779306', + 'ext': 'mov', 'upload_date': '20111205', 'description': 'md5:9bc31f227219cde65e47eeec8d2dc596', 'uploader': 'Comic Book Resources - CBR TV', 'title': 'CBR EXCLUSIVE: "Gotham City Imposters" Bats VS Jokerz Short 3', } - } + }, { + # With subtitles (ignored) #2274 + 'url': 'http://blip.tv/play/h6Uag5OEVgI.html', + 'md5': '309f9d25b820b086ca163ffac8031806', + 'info_dict': { + "id": "6586561", + "ext": "mp4", + "upload_date": "20130614", + "uploader": "Red vs. Blue", + "title": "Red vs. Blue Season 11 Episode 1", + "description": "One-Zero-One" + } + }] def report_direct_download(self, title): """Report information extraction."""