diff options
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | test/parameters.json | 3 | ||||
-rw-r--r-- | youtube_dl/aes.py | 4 | ||||
-rw-r--r-- | youtube_dl/extractor/canalplus.py | 13 | ||||
-rw-r--r-- | youtube_dl/extractor/common.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/dctp.py | 4 | ||||
-rw-r--r-- | youtube_dl/extractor/dotsub.py | 44 | ||||
-rw-r--r-- | youtube_dl/extractor/teamcoco.py | 8 | ||||
-rw-r--r-- | youtube_dl/extractor/youtube.py | 2 | ||||
-rw-r--r-- | youtube_dl/version.py | 2 |
10 files changed, 58 insertions, 25 deletions
@@ -3,4 +3,4 @@ universal = True [flake8] exclude = youtube_dl/extractor/__init__.py,devscripts/buildserver.py,setup.py,build,.git -ignore = E501 +ignore = E402,E501,E731 diff --git a/test/parameters.json b/test/parameters.json index 098cd0cd0..af77b89b4 100644 --- a/test/parameters.json +++ b/test/parameters.json @@ -39,5 +39,6 @@ "writesubtitles": false, "allsubtitles": false, "listssubtitles": false, - "socket_timeout": 20 + "socket_timeout": 20, + "fixup": "never" } diff --git a/youtube_dl/aes.py b/youtube_dl/aes.py index 5efd0f836..07224d508 100644 --- a/youtube_dl/aes.py +++ b/youtube_dl/aes.py @@ -1,7 +1,5 @@ from __future__ import unicode_literals -__all__ = ['aes_encrypt', 'key_expansion', 'aes_ctr_decrypt', 'aes_cbc_decrypt', 'aes_decrypt_text'] - import base64 from math import ceil @@ -329,3 +327,5 @@ def inc(data): data[i] = data[i] + 1 break return data + +__all__ = ['aes_encrypt', 'key_expansion', 'aes_ctr_decrypt', 'aes_cbc_decrypt', 'aes_decrypt_text'] diff --git a/youtube_dl/extractor/canalplus.py b/youtube_dl/extractor/canalplus.py index 11d18d74a..1b14471e5 100644 --- a/youtube_dl/extractor/canalplus.py +++ b/youtube_dl/extractor/canalplus.py @@ -15,12 +15,13 @@ from ..utils import ( class CanalplusIE(InfoExtractor): IE_DESC = 'canalplus.fr, piwiplus.fr and d8.tv' - _VALID_URL = r'https?://(?:www\.(?P<site>canalplus\.fr|piwiplus\.fr|d8\.tv)/.*?/(?P<path>.*)|player\.canalplus\.fr/#/(?P<id>[0-9]+))' + _VALID_URL = r'https?://(?:www\.(?P<site>canalplus\.fr|piwiplus\.fr|d8\.tv|itele\.fr)/.*?/(?P<path>.*)|player\.canalplus\.fr/#/(?P<id>[0-9]+))' _VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/%s/%s' _SITE_ID_MAP = { 'canalplus.fr': 'cplus', 'piwiplus.fr': 'teletoon', 'd8.tv': 'd8', + 'itele.fr': 'itele', } _TESTS = [{ @@ -53,6 +54,16 @@ class CanalplusIE(InfoExtractor): 'upload_date': '20131108', }, 'skip': 'videos get deleted after a while', + }, { + 'url': 'http://www.itele.fr/france/video/aubervilliers-un-lycee-en-colere-111559', + 'md5': '65aa83ad62fe107ce29e564bb8712580', + 'info_dict': { + 'id': '1213714', + 'ext': 'flv', + 'title': 'Aubervilliers : un lycée en colère - Le 11/02/2015 à 06h45', + 'description': 'md5:8216206ec53426ea6321321f3b3c16db', + 'upload_date': '20150211', + }, }] def _real_extract(self, url): diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 8d71494b4..48742189a 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -157,6 +157,7 @@ class InfoExtractor(object): view_count: How many users have watched the video on the platform. like_count: Number of positive ratings of the video dislike_count: Number of negative ratings of the video + average_rating: Average rating give by users, the scale used depends on the webpage comment_count: Number of comments on the video comments: A list of comments, each with one or more of the following properties (all but one of text or html optional): diff --git a/youtube_dl/extractor/dctp.py b/youtube_dl/extractor/dctp.py index 6ed354379..aa2c09eb6 100644 --- a/youtube_dl/extractor/dctp.py +++ b/youtube_dl/extractor/dctp.py @@ -14,6 +14,10 @@ class DctpTvIE(InfoExtractor): 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade', 'ext': 'flv', 'title': 'Videoinstallation für eine Kaufhausfassade' + }, + 'params': { + # rtmp download + 'skip_download': True, } } diff --git a/youtube_dl/extractor/dotsub.py b/youtube_dl/extractor/dotsub.py index 638bb33cd..f51d88a98 100644 --- a/youtube_dl/extractor/dotsub.py +++ b/youtube_dl/extractor/dotsub.py @@ -1,13 +1,14 @@ from __future__ import unicode_literals -import re -import time - from .common import InfoExtractor +from ..utils import ( + float_or_none, + int_or_none, +) class DotsubIE(InfoExtractor): - _VALID_URL = r'http://(?:www\.)?dotsub\.com/view/(?P<id>[^/]+)' + _VALID_URL = r'https?://(?:www\.)?dotsub\.com/view/(?P<id>[^/]+)' _TEST = { 'url': 'http://dotsub.com/view/aed3b8b2-1889-4df5-ae63-ad85f5572f27', 'md5': '0914d4d69605090f623b7ac329fea66e', @@ -15,28 +16,37 @@ class DotsubIE(InfoExtractor): 'id': 'aed3b8b2-1889-4df5-ae63-ad85f5572f27', 'ext': 'flv', 'title': 'Pyramids of Waste (2010), AKA The Lightbulb Conspiracy - Planned obsolescence documentary', + 'description': 'md5:699a0f7f50aeec6042cb3b1db2d0d074', + 'thumbnail': 're:^https?://dotsub.com/media/aed3b8b2-1889-4df5-ae63-ad85f5572f27/p', + 'duration': 3169, 'uploader': '4v4l0n42', - 'description': 'Pyramids of Waste (2010) also known as "The lightbulb conspiracy" is a documentary about how our economic system based on consumerism and planned obsolescence is breaking our planet down.\r\n\r\nSolutions to this can be found at:\r\nhttp://robotswillstealyourjob.com\r\nhttp://www.federicopistono.org\r\n\r\nhttp://opensourceecology.org\r\nhttp://thezeitgeistmovement.com', - 'thumbnail': 'http://dotsub.com/media/aed3b8b2-1889-4df5-ae63-ad85f5572f27/p', + 'timestamp': 1292248482.625, 'upload_date': '20101213', + 'view_count': int, } } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') - info_url = "https://dotsub.com/api/media/%s/metadata" % video_id - info = self._download_json(info_url, video_id) - date = time.gmtime(info['dateCreated'] / 1000) # The timestamp is in miliseconds + video_id = self._match_id(url) + + info = self._download_json( + 'https://dotsub.com/api/media/%s/metadata' % video_id, video_id) + video_url = info.get('mediaURI') + + if not video_url: + webpage = self._download_webpage(url, video_id) + video_url = self._search_regex( + r'"file"\s*:\s*\'([^\']+)', webpage, 'video url') return { 'id': video_id, - 'url': info['mediaURI'], + 'url': video_url, 'ext': 'flv', 'title': info['title'], - 'thumbnail': info['screenshotURI'], - 'description': info['description'], - 'uploader': info['user'], - 'view_count': info['numberOfViews'], - 'upload_date': '%04i%02i%02i' % (date.tm_year, date.tm_mon, date.tm_mday), + 'description': info.get('description'), + 'thumbnail': info.get('screenshotURI'), + 'duration': int_or_none(info.get('duration'), 1000), + 'uploader': info.get('user'), + 'timestamp': float_or_none(info.get('dateCreated'), 1000), + 'view_count': int_or_none(info.get('numberOfViews')), } diff --git a/youtube_dl/extractor/teamcoco.py b/youtube_dl/extractor/teamcoco.py index e85d452a3..a73da1c9c 100644 --- a/youtube_dl/extractor/teamcoco.py +++ b/youtube_dl/extractor/teamcoco.py @@ -30,6 +30,11 @@ class TeamcocoIE(InfoExtractor): } } ] + _VIDEO_ID_REGEXES = ( + r'"eVar42"\s*:\s*(\d+)', + r'Ginger\.TeamCoco\.openInApp\("video",\s*"([^"]+)"', + r'"id_not"\s*:\s*(\d+)' + ) def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) @@ -40,8 +45,7 @@ class TeamcocoIE(InfoExtractor): video_id = mobj.group("video_id") if not video_id: video_id = self._html_search_regex( - r'<div\s+class="player".*?data-id="(\d+?)"', - webpage, 'video id') + self._VIDEO_ID_REGEXES, webpage, 'video id') data_url = 'http://teamcoco.com/cvp/2.0/%s.xml' % video_id data = self._download_xml( diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 8b91fff18..35ef4c303 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -25,6 +25,7 @@ from ..compat import ( from ..utils import ( clean_html, ExtractorError, + float_or_none, get_element_by_attribute, get_element_by_id, int_or_none, @@ -1124,6 +1125,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor): 'view_count': view_count, 'like_count': like_count, 'dislike_count': dislike_count, + 'average_rating': float_or_none(video_info.get('avg_rating', [None])[0]), 'formats': formats, } diff --git a/youtube_dl/version.py b/youtube_dl/version.py index 225b30f8c..492ddf2ea 100644 --- a/youtube_dl/version.py +++ b/youtube_dl/version.py @@ -1,3 +1,3 @@ from __future__ import unicode_literals -__version__ = '2015.02.10.5' +__version__ = '2015.02.11' |