]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/cbsinteractive.py
2 from ..utils
import int_or_none
5 class CBSInteractiveIE(CBSIE
): # XXX: Do not subclass from concrete IE
6 _VALID_URL
= r
'https?://(?:www\.)?(?P<site>cnet|zdnet)\.com/(?:videos|video(?:/share)?)/(?P<id>[^/?]+)'
8 'url': 'http://www.cnet.com/videos/hands-on-with-microsofts-windows-8-1-update/',
10 'id': 'R49SYt__yAfmlXR85z4f7gNmCBDcN_00',
11 'display_id': 'hands-on-with-microsofts-windows-8-1-update',
13 'title': 'Hands-on with Microsoft Windows 8.1 Update',
14 'description': 'The new update to the Windows 8 OS brings improved performance for mouse and keyboard users.',
15 'uploader_id': '6085384d-619e-11e3-b231-14feb5ca9861',
16 'uploader': 'Sarah Mitroff',
18 'timestamp': 1396479627,
19 'upload_date': '20140402',
23 'skip_download': True,
26 'url': 'http://www.cnet.com/videos/whiny-pothole-tweets-at-local-government-when-hit-by-cars-tomorrow-daily-187/',
27 'md5': 'f11d27b2fa18597fbf92444d2a9ed386',
29 'id': 'kjOJd_OoVJqbg_ZD8MZCOk8Wekb9QccK',
30 'display_id': 'whiny-pothole-tweets-at-local-government-when-hit-by-cars-tomorrow-daily-187',
32 'title': 'Whiny potholes tweet at local government when hit by cars (Tomorrow Daily 187)',
33 'description': 'md5:d2b9a95a5ffe978ae6fbd4cf944d618f',
34 'uploader_id': 'b163284d-6b73-44fc-b3e6-3da66c392d40',
35 'uploader': 'Ashley Esqueda',
37 'timestamp': 1433289889,
38 'upload_date': '20150603',
41 'url': 'http://www.zdnet.com/video/share/video-keeping-android-smartphones-and-tablets-secure/',
43 'id': 'k0r4T_ehht4xW_hAOqiVQPuBDPZ8SRjt',
44 'display_id': 'video-keeping-android-smartphones-and-tablets-secure',
46 'title': 'Video: Keeping Android smartphones and tablets secure',
47 'description': 'Here\'s the best way to keep Android devices secure, and what you do when they\'ve come to the end of their lives.',
48 'uploader_id': 'f2d97ea2-8175-11e2-9d12-0018fe8a00b0',
49 'uploader': 'Adrian Kingsley-Hughes',
51 'timestamp': 1449129925,
52 'upload_date': '20151203',
56 'skip_download': True,
59 'url': 'http://www.zdnet.com/video/huawei-matebook-x-video/',
60 'only_matching': True,
68 def _real_extract(self
, url
):
69 site
, display_id
= self
._match
_valid
_url
(url
).groups()
70 webpage
= self
._download
_webpage
(url
, display_id
)
72 data_json
= self
._html
_search
_regex
(
73 r
"data(?:-(?:cnet|zdnet))?-video(?:-(?:uvp(?:js)?|player))?-options='([^']+)'",
75 data
= self
._parse
_json
(data_json
, display_id
)
76 vdata
= data
.get('video') or (data
.get('videos') or data
.get('playlist'))[0]
78 video_id
= vdata
['mpxRefId']
80 title
= vdata
['title']
81 author
= vdata
.get('author')
83 uploader
= '%s %s' % (author
['firstName'], author
['lastName'])
84 uploader_id
= author
.get('id')
89 info
= self
._extract
_video
_info
(video_id
, site
, self
.MPX_ACCOUNTS
[site
])
92 'display_id': display_id
,
94 'duration': int_or_none(vdata
.get('duration')),
96 'uploader_id': uploader_id
,