]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/statigram.py
Add an extractor for orf.at (closes #1346)
[yt-dlp.git] / youtube_dl / extractor / statigram.py
CommitLineData
38cbc40a
PH
1import re
2
3from .common import InfoExtractor
4
5class StatigramIE(InfoExtractor):
6 _VALID_URL = r'(?:http://)?(?:www\.)?statigr\.am/p/([^/]+)'
6f5ac90c 7 _TEST = {
683e98a8
JMF
8 u'url': u'http://statigr.am/p/522207370455279102_24101272',
9 u'file': u'522207370455279102_24101272.mp4',
10 u'md5': u'6eb93b882a3ded7c378ee1d6884b1814',
6f5ac90c 11 u'info_dict': {
683e98a8
JMF
12 u'uploader_id': u'aguynamedpatrick',
13 u'title': u'Instagram photo by @aguynamedpatrick (Patrick Janelle)',
14 },
6f5ac90c 15 }
38cbc40a
PH
16
17 def _real_extract(self, url):
18 mobj = re.match(self._VALID_URL, url)
19 video_id = mobj.group(1)
20 webpage = self._download_webpage(url, video_id)
38cbc40a
PH
21 html_title = self._html_search_regex(
22 r'<title>(.+?)</title>',
23 webpage, u'title')
48bfb5f2 24 title = re.sub(r'(?: *\(Videos?\))? \| Statigram$', '', html_title)
38cbc40a
PH
25 uploader_id = self._html_search_regex(
26 r'@([^ ]+)', title, u'uploader name', fatal=False)
27 ext = 'mp4'
28
29 return [{
30 'id': video_id,
46720279 31 'url': self._og_search_video_url(webpage),
38cbc40a
PH
32 'ext': ext,
33 'title': title,
46720279 34 'thumbnail': self._og_search_thumbnail(webpage),
38cbc40a
PH
35 'uploader_id' : uploader_id
36 }]