]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/statigram.py
Merge tag 'upstream/2013.06.26'
[youtubedl] / youtube_dl / extractor / statigram.py
1 import re
2
3 from .common import InfoExtractor
4
5 class StatigramIE(InfoExtractor):
6 _VALID_URL = r'(?:http://)?(?:www\.)?statigr\.am/p/([^/]+)'
7
8 def _real_extract(self, url):
9 mobj = re.match(self._VALID_URL, url)
10 video_id = mobj.group(1)
11 webpage = self._download_webpage(url, video_id)
12 video_url = self._html_search_regex(
13 r'<meta property="og:video:secure_url" content="(.+?)">',
14 webpage, u'video URL')
15 thumbnail_url = self._html_search_regex(
16 r'<meta property="og:image" content="(.+?)" />',
17 webpage, u'thumbnail URL', fatal=False)
18 html_title = self._html_search_regex(
19 r'<title>(.+?)</title>',
20 webpage, u'title')
21 title = html_title.rpartition(u' | Statigram')[0]
22 uploader_id = self._html_search_regex(
23 r'@([^ ]+)', title, u'uploader name', fatal=False)
24 ext = 'mp4'
25
26 return [{
27 'id': video_id,
28 'url': video_url,
29 'ext': ext,
30 'title': title,
31 'thumbnail': thumbnail_url,
32 'uploader_id' : uploader_id
33 }]