From: Sergey M․ Date: Wed, 1 Apr 2015 14:25:46 +0000 (+0600) Subject: Merge branch 'varzesh3' of https://github.com/mtp1376/youtube-dl into mtp1376-varzesh3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=youtube-dl;a=commitdiff_plain;h=69c3af567d852a0be7bb39b1ca7348e0d5712ec3;hp=60e1fe00799357145e1d43efc1a1548a8d9abb11 Merge branch 'varzesh3' of https://github.com/mtp1376/youtube-dl into mtp1376-varzesh3 --- diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 9fddb8e32..f3ebe4ee2 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -556,6 +556,7 @@ from .ultimedia import UltimediaIE from .unistra import UnistraIE from .urort import UrortIE from .ustream import UstreamIE, UstreamChannelIE +from .varzesh3 import Varzesh3IE from .vbox7 import Vbox7IE from .veehd import VeeHDIE from .veoh import VeohIE diff --git a/youtube_dl/extractor/varzesh3.py b/youtube_dl/extractor/varzesh3.py new file mode 100644 index 000000000..eb49586cc --- /dev/null +++ b/youtube_dl/extractor/varzesh3.py @@ -0,0 +1,48 @@ +# coding: utf-8 +from __future__ import unicode_literals +from .common import InfoExtractor +from ..utils import ( + ExtractorError, +) +import re + + +class Varzesh3IE(InfoExtractor): + _VALID_URL = r'(?P(https?://(?:www\.)?video\.varzesh3\.com)/(?P.+))' + _TEST ={ + 'url': 'http://video.varzesh3.com/germany/bundesliga/5-%D9%88%D8%A7%DA%A9%D9%86%D8%B4-%D8%A8%D8%B1%D8%AA%D8%B1-%D8%AF%D8%B1%D9%88%D8%A7%D8%B2%D9%87%E2%80%8C%D8%A8%D8%A7%D9%86%D8%A7%D9%86%D8%9B%D9%87%D9%81%D8%AA%D9%87-26-%D8%A8%D9%88%D9%86%D8%AF%D8%B3/', + 'md5': '2a933874cb7dce4366075281eb49e855', + 'info_dict': { + 'url': 'http://dl1.video.varzesh3.com/video/clip94/1/video/namayeshi/saves_week26.mp4', + 'id': '76337', + 'ext': 'mp4', + 'title': 'Ûµ واکنش برتر دروازه‌بانان؛هفته Û²Û¶ بوندسلیگا', + 'thumbnail': 'http://video.varzesh3.com/wp-content/uploads/230315_saves_week26.jpg', + 'description': 'فصل Û²Û°Û±Ûµ-Û²Û°Û±Û´', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + if not 'shortlink' in webpage: + raise ExtractorError('URL has no videos or there is a problem.') + + title = self._html_search_regex(r'meta[^>]+property="og:title"[^>]+content="([^"]+)"', webpage, 'title') + video_link = self._html_search_regex(r'source[^>]+src="([^"]+)"', webpage, 'video_link') + vid_id = self._html_search_regex(r"link[^>]+rel='canonical'[^>]+href='\/\?p=([^']+)'\/>", webpage, 'vid_id') + try: + description = self._html_search_regex(r'
(.*?)
', webpage, 'description', flags=re.DOTALL) + except: + description = title + thumbnail = self._html_search_regex(r'link[^>]+rel="image_src"[^>]+href="([^"]+)"', webpage, 'thumbnail') + + return { + 'url': video_link, + 'id': vid_id, + 'title': title, + 'ext': video_link.split(".")[-1], + 'description': description, + 'thumbnail': thumbnail, + }