mirror of https://github.com/yt-dlp/yt-dlp
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.
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
![]()
11 years ago
|
from .common import InfoExtractor
|
||
|
from ..utils import (
|
||
|
find_xpath_attr,
|
||
![]()
11 years ago
|
fix_xml_ampersands
|
||
![]()
11 years ago
|
)
|
||
|
|
||
|
|
||
|
class ClipsyndicateIE(InfoExtractor):
|
||
![]()
9 years ago
|
_VALID_URL = r'https?://(?:chic|www)\.clipsyndicate\.com/video/play(list/\d+)?/(?P<id>\d+)'
|
||
![]()
11 years ago
|
|
||
![]()
9 years ago
|
_TESTS = [{
|
||
![]()
11 years ago
|
'url': 'http://www.clipsyndicate.com/video/play/4629301/brick_briscoe',
|
||
|
'md5': '4d7d549451bad625e0ff3d7bd56d776c',
|
||
|
'info_dict': {
|
||
|
'id': '4629301',
|
||
|
'ext': 'mp4',
|
||
|
'title': 'Brick Briscoe',
|
||
|
'duration': 612,
|
||
![]()
8 years ago
|
'thumbnail': r're:^https?://.+\.jpg',
|
||
![]()
11 years ago
|
},
|
||
![]()
9 years ago
|
}, {
|
||
|
'url': 'http://chic.clipsyndicate.com/video/play/5844117/shark_attack',
|
||
|
'only_matching': True,
|
||
|
}]
|
||
![]()
11 years ago
|
|
||
|
def _real_extract(self, url):
|
||
![]()
9 years ago
|
video_id = self._match_id(url)
|
||
![]()
11 years ago
|
js_player = self._download_webpage(
|
||
|
'http://eplayer.clipsyndicate.com/embed/player.js?va_id=%s' % video_id,
|
||
![]()
11 years ago
|
video_id, 'Downlaoding player')
|
||
![]()
11 years ago
|
# it includes a required token
|
||
![]()
11 years ago
|
flvars = self._search_regex(r'flvars: "(.*?)"', js_player, 'flvars')
|
||
![]()
11 years ago
|
|
||
![]()
11 years ago
|
pdoc = self._download_xml(
|
||
![]()
11 years ago
|
'http://eplayer.clipsyndicate.com/osmf/playlist?%s' % flvars,
|
||
![]()
11 years ago
|
video_id, 'Downloading video info',
|
||
![]()
11 years ago
|
transform_source=fix_xml_ampersands)
|
||
![]()
11 years ago
|
|
||
|
track_doc = pdoc.find('trackList/track')
|
||
![]()
10 years ago
|
|
||
![]()
11 years ago
|
def find_param(name):
|
||
|
node = find_xpath_attr(track_doc, './/param', 'name', name)
|
||
|
if node is not None:
|
||
|
return node.attrib['value']
|
||
|
|
||
|
return {
|
||
|
'id': video_id,
|
||
|
'title': find_param('title'),
|
||
|
'url': track_doc.find('location').text,
|
||
|
'thumbnail': find_param('thumbnail'),
|
||
|
'duration': int(find_param('duration')),
|
||
|
}
|