]>
Commit | Line | Data |
---|---|---|
5c321101 | 1 | from __future__ import unicode_literals |
bba12cec JMF |
2 | |
3 | from .common import InfoExtractor | |
4 | from ..utils import ( | |
5 | find_xpath_attr, | |
5c321101 | 6 | int_or_none, |
bba12cec JMF |
7 | ) |
8 | ||
5f6a1245 | 9 | |
bba12cec | 10 | class VideofyMeIE(InfoExtractor): |
5c321101 PH |
11 | _VALID_URL = r'https?://(?:www\.videofy\.me/.+?|p\.videofy\.me/v)/(?P<id>\d+)(&|#|$)' |
12 | IE_NAME = 'videofy.me' | |
bba12cec JMF |
13 | |
14 | _TEST = { | |
5c321101 PH |
15 | 'url': 'http://www.videofy.me/thisisvideofyme/1100701', |
16 | 'md5': 'c77d700bdc16ae2e9f3c26019bd96143', | |
17 | 'info_dict': { | |
18 | 'id': '1100701', | |
19 | 'ext': 'mp4', | |
20 | 'title': 'This is VideofyMe', | |
21 | 'description': None, | |
22 | 'uploader': 'VideofyMe', | |
23 | 'uploader_id': 'thisisvideofyme', | |
24 | 'view_count': int, | |
bba12cec | 25 | }, |
5f6a1245 | 26 | |
bba12cec JMF |
27 | } |
28 | ||
29 | def _real_extract(self, url): | |
5c321101 | 30 | video_id = self._match_id(url) |
e26f8712 | 31 | config = self._download_xml('http://sunshine.videofy.me/?videoId=%s' % video_id, |
9e1a5b84 | 32 | video_id) |
bba12cec JMF |
33 | video = config.find('video') |
34 | sources = video.find('sources') | |
5f6a1245 | 35 | url_node = next(node for node in [find_xpath_attr(sources, 'source', 'id', 'HQ %s' % key) |
9e1a5b84 | 36 | for key in ['on', 'av', 'off']] if node is not None) |
bba12cec | 37 | video_url = url_node.find('url').text |
5c321101 PH |
38 | view_count = int_or_none(self._search_regex( |
39 | r'([0-9]+)', video.find('views').text, 'view count', fatal=False)) | |
bba12cec | 40 | |
5c321101 PH |
41 | return { |
42 | 'id': video_id, | |
43 | 'title': video.find('title').text, | |
44 | 'url': video_url, | |
45 | 'thumbnail': video.find('thumb').text, | |
46 | 'description': video.find('description').text, | |
47 | 'uploader': config.find('blog/name').text, | |
48 | 'uploader_id': video.find('identifier').text, | |
49 | 'view_count': view_count, | |
50 | } |