1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-23 19:52:52 +08:00
youtube-dl/youtube_dl/extractor/ir90tv.py

43 lines
1.7 KiB
Python
Raw Normal View History

2015-05-08 08:50:46 +08:00
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
2015-07-25 18:42:40 +08:00
from ..utils import remove_start
2015-05-08 08:50:46 +08:00
class Ir90TvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?90tv\.ir/video/(?P<id>[0-9]+)/.*'
_TESTS = [{
2015-05-08 08:50:46 +08:00
'url': 'http://90tv.ir/video/95719/%D8%B4%D8%A7%DB%8C%D8%B9%D8%A7%D8%AA-%D9%86%D9%82%D9%84-%D9%88-%D8%A7%D9%86%D8%AA%D9%82%D8%A7%D9%84%D8%A7%D8%AA-%D9%85%D9%87%D9%85-%D9%81%D9%88%D8%AA%D8%A8%D8%A7%D9%84-%D8%A7%D8%B1%D9%88%D9%BE%D8%A7-940218',
'md5': '411dbd94891381960cb9e13daa47a869',
'info_dict': {
'id': '95719',
'ext': 'mp4',
'title': 'شایعات نقل و انتقالات مهم فوتبال اروپا 94/02/18',
'thumbnail': 're:^https?://.*\.jpg$',
}
}, {
'url': 'http://www.90tv.ir/video/95719/%D8%B4%D8%A7%DB%8C%D8%B9%D8%A7%D8%AA-%D9%86%D9%82%D9%84-%D9%88-%D8%A7%D9%86%D8%AA%D9%82%D8%A7%D9%84%D8%A7%D8%AA-%D9%85%D9%87%D9%85-%D9%81%D9%88%D8%AA%D8%A8%D8%A7%D9%84-%D8%A7%D8%B1%D9%88%D9%BE%D8%A7-940218',
'only_matching': True,
}]
2015-05-08 08:50:46 +08:00
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
2015-07-25 18:42:40 +08:00
title = remove_start(self._html_search_regex(
r'<title>([^<]+)</title>', webpage, 'title'), '90tv.ir :: ')
2015-05-08 08:50:46 +08:00
video_url = self._search_regex(
r'<source[^>]+src="([^"]+)"', webpage, 'video url')
thumbnail = self._search_regex(r'poster="([^"]+)"', webpage, 'thumbnail url', fatal=False)
2015-05-08 08:50:46 +08:00
return {
'url': video_url,
'id': video_id,
'title': title,
2015-07-25 18:43:07 +08:00
'video_url': video_url,
'thumbnail': thumbnail,
2015-05-08 08:55:01 +08:00
}