2 from __future__ import unicode_literals
7 from .common import InfoExtractor
14 class CNETIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?cnet\.com/videos/(?P<id>[^/]+)/'
17 'url': 'http://www.cnet.com/videos/hands-on-with-microsofts-windows-8-1-update/',
19 'id': '56f4ea68-bd21-4852-b08c-4de5b8354c60',
21 'title': 'Hands-on with Microsoft Windows 8.1 Update',
22 'description': 'The new update to the Windows 8 OS brings improved performance for mouse and keyboard users.',
23 'thumbnail': 're:^http://.*/flmswindows8.jpg$',
24 'uploader_id': '6085384d-619e-11e3-b231-14feb5ca9861',
25 'uploader': 'Sarah Mitroff',
28 'skip_download': 'requires rtmpdump',
32 def _real_extract(self, url):
33 display_id = self._match_id(url)
34 webpage = self._download_webpage(url, display_id)
36 data_json = self._html_search_regex(
37 r"<div class=\"cnetVideoPlayer\"\s+.*?data-cnet-video-options='([^']+)'",
39 data = json.loads(data_json)
42 vdata = data['videos'][0]
44 raise ExtractorError('Cannot find video data')
46 mpx_account = data['config']['players']['default']['mpx_account']
47 vid = vdata['files']['rtmp']
48 tp_link = 'http://link.theplatform.com/s/%s/%s' % (mpx_account, vid)
50 video_id = vdata['id']
51 title = vdata.get('headline')
53 title = vdata.get('title')
55 raise ExtractorError('Cannot find title!')
56 thumbnail = vdata.get('image', {}).get('path')
57 author = vdata.get('author')
59 uploader = '%s %s' % (author['firstName'], author['lastName'])
60 uploader_id = author.get('id')
66 '_type': 'url_transparent',
69 'display_id': display_id,
72 'uploader_id': uploader_id,
73 'thumbnail': thumbnail,