]>
Commit | Line | Data |
---|---|---|
f46f4a99 PH |
1 | from __future__ import unicode_literals |
2 | ||
99e350d9 JMF |
3 | import re |
4 | import json | |
5 | ||
6 | from .common import InfoExtractor | |
f46f4a99 | 7 | |
99e350d9 JMF |
8 | |
9 | class VeohIE(InfoExtractor): | |
4ddba33f | 10 | _VALID_URL = r'http://(?:www\.)?veoh\.com/(?:watch|iphone/#_Watch)/v(?P<id>\d*)' |
99e350d9 JMF |
11 | |
12 | _TEST = { | |
f46f4a99 PH |
13 | 'url': 'http://www.veoh.com/watch/v56314296nk7Zdmz3', |
14 | 'file': '56314296.mp4', | |
15 | 'md5': '620e68e6a3cff80086df3348426c9ca3', | |
16 | 'info_dict': { | |
17 | 'title': 'Straight Backs Are Stronger', | |
18 | 'uploader': 'LUMOback', | |
19 | 'description': 'At LUMOback, we believe straight backs are stronger. The LUMOback Posture & Movement Sensor: It gently vibrates when you slouch, inspiring improved posture and mobility. Use the app to track your data and improve your posture over time. ', | |
99e350d9 JMF |
20 | } |
21 | } | |
22 | ||
23 | def _real_extract(self, url): | |
24 | mobj = re.match(self._VALID_URL, url) | |
25 | video_id = mobj.group('id') | |
26 | webpage = self._download_webpage(url, video_id) | |
27 | ||
28 | m_youtube = re.search(r'http://www\.youtube\.com/v/(.*?)(\&|")', webpage) | |
29 | if m_youtube is not None: | |
30 | youtube_id = m_youtube.group(1) | |
f46f4a99 | 31 | self.to_screen('%s: detected Youtube video.' % video_id) |
99e350d9 JMF |
32 | return self.url_result(youtube_id, 'Youtube') |
33 | ||
34 | self.report_extraction(video_id) | |
35 | info = self._search_regex(r'videoDetailsJSON = \'({.*?})\';', webpage, 'info') | |
36 | info = json.loads(info) | |
f46f4a99 PH |
37 | video_url = info.get('fullPreviewHashHighPath') or info.get('fullPreviewHashLowPath') |
38 | ||
39 | return { | |
40 | 'id': info['videoId'], | |
41 | 'title': info['title'], | |
42 | 'url': video_url, | |
43 | 'uploader': info['username'], | |
44 | 'thumbnail': info.get('highResImage') or info.get('medResImage'), | |
45 | 'description': info['description'], | |
46 | 'view_count': info['views'], | |
47 | } |