1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-14 07:02:34 +01:00
yt-dlp/youtube_dl/extractor/varzesh3.py

46 lines
1.7 KiB
Python
Raw Normal View History

2015-03-26 14:47:21 +01:00
# coding: utf-8
from __future__ import unicode_literals
2015-04-01 18:02:55 +02:00
2015-03-26 14:47:21 +01:00
from .common import InfoExtractor
class Varzesh3IE(InfoExtractor):
2015-04-01 18:02:55 +02:00
_VALID_URL = r'https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+)/?'
_TEST = {
2015-03-26 14:47:21 +01: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',
'title': '۵ واکنش برتر دروازه‌بانان؛هفته ۲۶ بوندسلیگا',
2015-03-26 20:23:57 +01:00
'description': 'فصل ۲۰۱۵-۲۰۱۴',
2015-04-01 18:02:55 +02:00
'thumbnail': 're:^https?://.*\.jpg$',
2015-03-26 14:47:21 +01:00
}
}
2015-03-26 14:47:21 +01:00
def _real_extract(self, url):
2015-04-01 18:02:55 +02: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 14:47:21 +01:00
2015-04-01 18:02:55 +02:00
title = self._og_search_title(webpage)
description = self._html_search_regex(
r'(?s)<div class="matn">(.+?)</div>',
webpage, 'description', fatal=False)
thumbnail = self._og_search_thumbnail(webpage)
2015-03-26 14:47:21 +01:00
2015-04-01 18:02:55 +02:00
video_id = self._search_regex(
r"<link[^>]+rel='(?:canonical|shortlink)'[^>]+href='/\?p=([^']+)'",
webpage, display_id, default=display_id)
2015-03-26 14:47:21 +01:00
return {
2015-04-01 18:02:55 +02:00
'url': video_url,
'id': video_id,
2015-03-26 14:47:21 +01:00
'title': title,
'description': description,
'thumbnail': thumbnail,
}