From: Philipp Hagemeister Date: Tue, 13 May 2014 08:11:14 +0000 (+0200) Subject: Merge remote-tracking branch 'hojel/empflix' X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=youtube-dl;a=commitdiff_plain;h=feb72212091189353c0d6308fa20e4f33cc82da1;hp=877bea9ce18d717a294923edc41c6340b1469b4b Merge remote-tracking branch 'hojel/empflix' --- diff --git a/.travis.yml b/.travis.yml index 45b71f11b..c6cc7a994 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ python: - "2.6" - "2.7" - "3.3" + - "3.4" script: nosetests test --verbose notifications: email: diff --git a/test/helper.py b/test/helper.py index d5e0a603e..230d2bd67 100644 --- a/test/helper.py +++ b/test/helper.py @@ -107,7 +107,7 @@ def expect_info_dict(self, expected_dict, got_dict): elif isinstance(expected, type): got = got_dict.get(info_field) self.assertTrue(isinstance(got, expected), - u'Expected type %r, but got value %r of type %r' % (expected, got, type(got))) + u'Expected type %r for field %s, but got value %r of type %r' % (expected, info_field, got, type(got))) else: if isinstance(expected, compat_str) and expected.startswith('md5:'): got = 'md5:' + md5(got_dict.get(info_field)) diff --git a/test/test_playlists.py b/test/test_playlists.py index fe6274e60..cc871698a 100644 --- a/test/test_playlists.py +++ b/test/test_playlists.py @@ -23,6 +23,7 @@ from youtube_dl.extractor import ( VimeoUserIE, VimeoAlbumIE, VimeoGroupsIE, + VineUserIE, UstreamChannelIE, SoundcloudSetIE, SoundcloudUserIE, @@ -102,6 +103,13 @@ class TestPlaylists(unittest.TestCase): self.assertEqual(result['title'], 'Rolex Awards for Enterprise') self.assertTrue(len(result['entries']) > 72) + def test_vine_user(self): + dl = FakeYDL() + ie = VineUserIE(dl) + result = ie.extract('https://vine.co/Visa') + self.assertIsPlaylist(result) + self.assertTrue(len(result['entries']) >= 50) + def test_ustream_channel(self): dl = FakeYDL() ie = UstreamChannelIE(dl) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 7ed8d1970..4e657e297 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -54,6 +54,8 @@ __authors__ = ( 'phaer', 'Sainyam Kapoor', 'Nicolas Évrard', + 'Jason Normore', + 'Hoje Lee', ) __license__ = 'Public Domain' diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 23b7cbd8f..3503c76b7 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -80,6 +80,7 @@ from .exfm import ExfmIE from .extremetube import ExtremeTubeIE from .facebook import FacebookIE from .faz import FazIE +from .fc2 import FC2IE from .firstpost import FirstpostIE from .firsttv import FirstTVIE from .fivemin import FiveMinIE @@ -110,6 +111,7 @@ from .googleplus import GooglePlusIE from .googlesearch import GoogleSearchIE from .hark import HarkIE from .helsinki import HelsinkiIE +from .hentaistigma import HentaiStigmaIE from .hotnewhiphop import HotNewHipHopIE from .howcast import HowcastIE from .huffpost import HuffPostIE @@ -195,6 +197,7 @@ from .nowvideo import NowVideoIE from .nrk import NRKIE from .ntv import NTVIE from .nytimes import NYTimesIE +from .nuvid import NuvidIE from .oe1 import OE1IE from .ooyala import OoyalaIE from .orf import ORFIE @@ -231,6 +234,7 @@ from .scivee import SciVeeIE from .servingsys import ServingSysIE from .sina import SinaIE from .slideshare import SlideshareIE +from .slutload import SlutloadIE from .smotri import ( SmotriIE, SmotriCommunityIE, @@ -296,6 +300,7 @@ from .videodetective import VideoDetectiveIE from .videolecturesnet import VideoLecturesNetIE from .videofyme import VideofyMeIE from .videopremium import VideoPremiumIE +from .videott import VideoTtIE from .videoweed import VideoWeedIE from .vimeo import ( VimeoIE, @@ -306,7 +311,10 @@ from .vimeo import ( VimeoReviewIE, VimeoWatchLaterIE, ) -from .vine import VineIE +from .vine import ( + VineIE, + VineUserIE, +) from .viki import VikiIE from .vk import VKIE from .vube import VubeIE @@ -315,6 +323,7 @@ from .washingtonpost import WashingtonPostIE from .wat import WatIE from .wdr import ( WDRIE, + WDRMobileIE, WDRMausIE, ) from .weibo import WeiboIE diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 10b0cbe69..11b31db88 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -242,10 +242,11 @@ class InfoExtractor(object): url = url_or_request.get_full_url() except AttributeError: url = url_or_request - if len(url) > 200: - h = u'___' + hashlib.md5(url.encode('utf-8')).hexdigest() - url = url[:200 - len(h)] + h - raw_filename = ('%s_%s.dump' % (video_id, url)) + basen = video_id + '_' + url + if len(basen) > 240: + h = u'___' + hashlib.md5(basen.encode('utf-8')).hexdigest() + basen = basen[:240 - len(h)] + h + raw_filename = basen + '.dump' filename = sanitize_filename(raw_filename, restricted=True) self.to_screen(u'Saving request to ' + filename) with open(filename, 'wb') as outf: @@ -555,6 +556,16 @@ class InfoExtractor(object): if self._downloader.params.get('prefer_insecure', False) else 'https:') + def _proto_relative_url(self, url, scheme=None): + if url is None: + return url + if url.startswith('//'): + if scheme is None: + scheme = self.http_scheme() + return scheme + url + else: + return url + class SearchInfoExtractor(InfoExtractor): """ diff --git a/youtube_dl/extractor/fc2.py b/youtube_dl/extractor/fc2.py new file mode 100644 index 000000000..ca8993241 --- /dev/null +++ b/youtube_dl/extractor/fc2.py @@ -0,0 +1,60 @@ +#! -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import re +import hashlib + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + compat_urllib_request, + compat_urlparse, +) + + +class FC2IE(InfoExtractor): + _VALID_URL = r'^http://video\.fc2\.com/(?P[^/]+)/content/(?P[^/]+)' + IE_NAME = 'fc2' + _TEST = { + 'url': 'http://video.fc2.com/en/content/20121103kUan1KHs', + 'md5': 'a6ebe8ebe0396518689d963774a54eb7', + 'info_dict': { + 'id': '20121103kUan1KHs', + 'ext': 'flv', + 'title': 'Boxing again with Puff', + }, + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + self._downloader.cookiejar.clear_session_cookies() # must clear + + title = self._og_search_title(webpage) + thumbnail = self._og_search_thumbnail(webpage) + refer = url.replace('/content/', '/a/content/') + + mimi = hashlib.md5(video_id + '_gGddgPfeaf_gzyr').hexdigest() + + info_url = ( + "http://video.fc2.com/ginfo.php?mimi={1:s}&href={2:s}&v={0:s}&fversion=WIN%2011%2C6%2C602%2C180&from=2&otag=0&upid={0:s}&tk=null&". + format(video_id, mimi, compat_urllib_request.quote(refer, safe='').replace('.','%2E'))) + + info_webpage = self._download_webpage( + info_url, video_id, note='Downloading info page') + info = compat_urlparse.parse_qs(info_webpage) + + if 'err_code' in info: + raise ExtractorError('Error code: %s' % info['err_code'][0]) + + video_url = info['filepath'][0] + '?mid=' + info['mid'][0] + + return { + 'id': video_id, + 'title': info['title'][0], + 'url': video_url, + 'ext': 'flv', + 'thumbnail': thumbnail, + } diff --git a/youtube_dl/extractor/hentaistigma.py b/youtube_dl/extractor/hentaistigma.py new file mode 100644 index 000000000..63d87b74c --- /dev/null +++ b/youtube_dl/extractor/hentaistigma.py @@ -0,0 +1,42 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor + + +class HentaiStigmaIE(InfoExtractor): + _VALID_URL = r'^https?://hentai\.animestigma\.com/(?P[^/]+)' + _TEST = { + 'url': 'http://hentai.animestigma.com/inyouchuu-etsu-bonus/', + 'md5': '4e3d07422a68a4cc363d8f57c8bf0d23', + 'info_dict': { + 'id': 'inyouchuu-etsu-bonus', + 'ext': 'mp4', + "title": "Inyouchuu Etsu Bonus", + "age_limit": 18, + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + + title = self._html_search_regex( + r'

]*>([^<]+)', + webpage, 'title') + wrap_url = self._html_search_regex( + r'