You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.3 KiB

  1. import re
  2. from .common import InfoExtractor
  3. class StatigramIE(InfoExtractor):
  4. _VALID_URL = r'(?:http://)?(?:www\.)?statigr\.am/p/([^/]+)'
  5. _TEST = {
  6. u'url': u'http://statigr.am/p/522207370455279102_24101272',
  7. u'file': u'522207370455279102_24101272.mp4',
  8. u'md5': u'6eb93b882a3ded7c378ee1d6884b1814',
  9. u'info_dict': {
  10. u'uploader_id': u'aguynamedpatrick',
  11. u'title': u'Instagram photo by @aguynamedpatrick (Patrick Janelle)',
  12. },
  13. }
  14. def _real_extract(self, url):
  15. mobj = re.match(self._VALID_URL, url)
  16. video_id = mobj.group(1)
  17. webpage = self._download_webpage(url, video_id)
  18. html_title = self._html_search_regex(
  19. r'<title>(.+?)</title>',
  20. webpage, u'title')
  21. title = re.sub(r'(?: *\(Videos?\))? \| Statigram$', '', html_title)
  22. uploader_id = self._html_search_regex(
  23. r'@([^ ]+)', title, u'uploader name', fatal=False)
  24. ext = 'mp4'
  25. return [{
  26. 'id': video_id,
  27. 'url': self._og_search_video_url(webpage),
  28. 'ext': ext,
  29. 'title': title,
  30. 'thumbnail': self._og_search_thumbnail(webpage),
  31. 'uploader_id' : uploader_id
  32. }]