mirror of https://github.com/blackjack4494/yt-dlc
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.9 KiB
Python
61 lines
1.9 KiB
Python
8 years ago
|
# coding: utf-8
|
||
11 years ago
|
from __future__ import unicode_literals
|
||
|
|
||
|
import json
|
||
|
|
||
|
from .common import InfoExtractor
|
||
|
from ..utils import (
|
||
|
int_or_none,
|
||
10 years ago
|
js_to_json,
|
||
11 years ago
|
)
|
||
|
|
||
|
|
||
|
class KrasViewIE(InfoExtractor):
|
||
|
IE_DESC = 'Красвью'
|
||
10 years ago
|
_VALID_URL = r'https?://krasview\.ru/(?:video|embed)/(?P<id>\d+)'
|
||
11 years ago
|
|
||
|
_TEST = {
|
||
|
'url': 'http://krasview.ru/video/512228',
|
||
|
'md5': '3b91003cf85fc5db277870c8ebd98eae',
|
||
|
'info_dict': {
|
||
|
'id': '512228',
|
||
|
'ext': 'mp4',
|
||
|
'title': 'Снег, лёд, заносы',
|
||
|
'description': 'Снято в городе Нягань, в Ханты-Мансийском автономном округе.',
|
||
|
'duration': 27,
|
||
8 years ago
|
'thumbnail': r're:^https?://.*\.jpg',
|
||
11 years ago
|
},
|
||
9 years ago
|
'params': {
|
||
|
'skip_download': 'Not accessible from Travis CI server',
|
||
|
},
|
||
11 years ago
|
}
|
||
|
|
||
|
def _real_extract(self, url):
|
||
10 years ago
|
video_id = self._match_id(url)
|
||
11 years ago
|
|
||
|
webpage = self._download_webpage(url, video_id)
|
||
|
|
||
10 years ago
|
flashvars = json.loads(js_to_json(self._search_regex(
|
||
|
r'video_Init\(({.+?})', webpage, 'flashvars')))
|
||
11 years ago
|
|
||
|
video_url = flashvars['url']
|
||
10 years ago
|
title = self._og_search_title(webpage)
|
||
|
description = self._og_search_description(webpage, default=None)
|
||
|
thumbnail = flashvars.get('image') or self._og_search_thumbnail(webpage)
|
||
|
duration = int_or_none(flashvars.get('duration'))
|
||
10 years ago
|
width = int_or_none(self._og_search_property(
|
||
|
'video:width', webpage, 'video width', default=None))
|
||
|
height = int_or_none(self._og_search_property(
|
||
|
'video:height', webpage, 'video height', default=None))
|
||
11 years ago
|
|
||
|
return {
|
||
|
'id': video_id,
|
||
|
'url': video_url,
|
||
|
'title': title,
|
||
|
'description': description,
|
||
|
'thumbnail': thumbnail,
|
||
|
'duration': duration,
|
||
|
'width': width,
|
||
|
'height': height,
|
||
|
}
|