4 from .common
import InfoExtractor
14 class KUSIIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?kusi\.com/(?P<path>story/.+|video\?clipId=(?P<clipId>\d+))'
17 'url': 'http://www.kusi.com/story/32849881/turko-files-refused-to-help-it-aint-right',
18 'md5': '4e76ce8e53660ce9697d06c0ba6fc47d',
22 'title': "Turko Files: Refused to Help, It Ain't Right!",
24 'upload_date': '20160826',
25 'timestamp': 1472233118,
26 'thumbnail': r
're:^https?://.*\.jpg$'
29 'url': 'http://kusi.com/video?clipId=12203019',
30 'only_matching': True,
33 def _real_extract(self
, url
):
34 mobj
= self
._match
_valid
_url
(url
)
35 clip_id
= mobj
.group('clipId')
36 video_id
= clip_id
or mobj
.group('path')
38 webpage
= self
._download
_webpage
(url
, video_id
)
41 video_id
= clip_id
= self
._html
_search
_regex
(
42 r
'"clipId"\s*,\s*"(\d+)"', webpage
, 'clip id')
44 affiliate_id
= self
._search
_regex
(
45 r
'affiliateId\s*:\s*\'([^
\']+)\'', webpage, 'affiliate
id')
47 # See __Packages/worldnow/model/GalleryModel.as of WNGallery.swf
48 xml_url = update_url_query('http
://www
.kusi
.com
/build
.asp
', {
49 'buildtype
': 'buildfeaturexmlrequest
',
50 'featureType
': 'Clip
',
52 'affiliateno
': affiliate_id,
54 'rnd
': int(round(random.random() * 1000000)),
57 doc = self._download_xml(xml_url, video_id)
59 video_title = xpath_text(doc, 'HEADLINE
', fatal=True)
60 duration = float_or_none(xpath_text(doc, 'DURATION
'), scale=1000)
61 description = xpath_text(doc, 'ABSTRACT
')
62 thumbnail = xpath_text(doc, './THUMBNAILIMAGE
/FILENAME
')
63 creation_time = timeconvert(xpath_text(doc, 'rfc822creationdate
'))
65 quality_options = doc.find('{http://search.yahoo.com/mrss/}group
').findall('{http://search.yahoo.com/mrss/}content
')
67 for quality in quality_options:
69 'url
': urllib.parse.unquote_plus(quality.attrib['url
']),
70 'height
': int_or_none(quality.attrib.get('height
')),
71 'width
': int_or_none(quality.attrib.get('width
')),
72 'vbr
': float_or_none(quality.attrib.get('bitratebits
'), scale=1000),
74 self._sort_formats(formats)
79 'description
': description,
82 'thumbnail
': thumbnail,
83 'timestamp
': creation_time,