2015-03-26 09:47:21 -04:00
|
|
|
|
from .common import InfoExtractor
|
2016-04-16 05:13:22 -04:00
|
|
|
|
from ..utils import (
|
|
|
|
|
clean_html,
|
2021-08-22 15:02:00 -04:00
|
|
|
|
parse_qs,
|
2016-04-16 05:13:22 -04:00
|
|
|
|
remove_start,
|
|
|
|
|
)
|
2015-03-26 09:47:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Varzesh3IE(InfoExtractor):
|
2024-03-08 19:02:45 -05:00
|
|
|
|
_WORKING = False
|
2015-04-01 12:02:55 -04:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+)/?'
|
2016-04-16 05:13:22 -04:00
|
|
|
|
_TESTS = [{
|
2015-03-26 09:47:21 -04:00
|
|
|
|
'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': {
|
|
|
|
|
'id': '76337',
|
|
|
|
|
'ext': 'mp4',
|
2015-03-26 11:36:50 -04:00
|
|
|
|
'title': '۵ واکنش برتر دروازهبانان؛هفته ۲۶ بوندسلیگا',
|
2015-03-26 15:23:57 -04:00
|
|
|
|
'description': 'فصل ۲۰۱۵-۲۰۱۴',
|
2017-01-02 07:08:07 -05:00
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
2016-04-16 05:13:22 -04:00
|
|
|
|
},
|
|
|
|
|
'skip': 'HTTP 404 Error',
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://video.varzesh3.com/video/112785/%D8%AF%D9%84%D9%87-%D8%B9%D9%84%DB%8C%D8%9B-%D8%B3%D8%AA%D8%A7%D8%B1%D9%87-%D9%86%D9%88%D8%B8%D9%87%D9%88%D8%B1-%D9%84%DB%8C%DA%AF-%D8%A8%D8%B1%D8%AA%D8%B1-%D8%AC%D8%B2%DB%8C%D8%B1%D9%87',
|
2016-04-16 05:37:44 -04:00
|
|
|
|
'md5': '841b7cd3afbc76e61708d94e53a4a4e7',
|
2016-04-16 05:13:22 -04:00
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '112785',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': 'دله علی؛ ستاره نوظهور لیگ برتر جزیره',
|
|
|
|
|
'description': 'فوتبال 120',
|
|
|
|
|
},
|
|
|
|
|
'expected_warnings': ['description'],
|
|
|
|
|
}]
|
2015-03-26 09:47:21 -04:00
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2015-04-01 12:02:55 -04:00
|
|
|
|
display_id = self._match_id(url)
|
|
|
|
|
|
|
|
|
|
webpage = self._download_webpage(url, display_id)
|
|
|
|
|
|
|
|
|
|
video_url = self._search_regex(
|
|
|
|
|
r'<source[^>]+src="([^"]+)"', webpage, 'video url')
|
2015-03-26 09:47:21 -04:00
|
|
|
|
|
2022-04-04 04:27:35 -04:00
|
|
|
|
title = remove_start(self._html_extract_title(webpage), 'ویدیو ورزش 3 | ')
|
2016-04-16 05:13:22 -04:00
|
|
|
|
|
2015-04-01 12:02:55 -04:00
|
|
|
|
description = self._html_search_regex(
|
|
|
|
|
r'(?s)<div class="matn">(.+?)</div>',
|
2016-04-16 05:13:22 -04:00
|
|
|
|
webpage, 'description', default=None)
|
|
|
|
|
if description is None:
|
|
|
|
|
description = clean_html(self._html_search_meta('description', webpage))
|
|
|
|
|
|
|
|
|
|
thumbnail = self._og_search_thumbnail(webpage, default=None)
|
|
|
|
|
if thumbnail is None:
|
|
|
|
|
fb_sharer_url = self._search_regex(
|
|
|
|
|
r'<a[^>]+href="(https?://www\.facebook\.com/sharer/sharer\.php?[^"]+)"',
|
|
|
|
|
webpage, 'facebook sharer URL', fatal=False)
|
2021-08-22 15:02:00 -04:00
|
|
|
|
sharer_params = parse_qs(fb_sharer_url)
|
2016-04-16 05:13:22 -04:00
|
|
|
|
thumbnail = sharer_params.get('p[images][0]', [None])[0]
|
2015-03-26 09:47:21 -04:00
|
|
|
|
|
2015-04-01 12:02:55 -04:00
|
|
|
|
video_id = self._search_regex(
|
|
|
|
|
r"<link[^>]+rel='(?:canonical|shortlink)'[^>]+href='/\?p=([^']+)'",
|
2016-04-16 05:13:22 -04:00
|
|
|
|
webpage, display_id, default=None)
|
|
|
|
|
if video_id is None:
|
|
|
|
|
video_id = self._search_regex(
|
2017-01-02 07:08:07 -05:00
|
|
|
|
r'var\s+VideoId\s*=\s*(\d+);', webpage, 'video id',
|
2016-04-16 05:13:22 -04:00
|
|
|
|
default=display_id)
|
2015-03-26 09:47:21 -04:00
|
|
|
|
|
|
|
|
|
return {
|
2015-04-01 12:02:55 -04:00
|
|
|
|
'url': video_url,
|
|
|
|
|
'id': video_id,
|
2015-03-26 09:47:21 -04:00
|
|
|
|
'title': title,
|
|
|
|
|
'description': description,
|
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
|
}
|