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.2 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/484091715184808010_284179915',
  7. u'file': u'484091715184808010_284179915.mp4',
  8. u'md5': u'deda4ff333abe2e118740321e992605b',
  9. u'info_dict': {
  10. u"uploader_id": u"videoseconds",
  11. u"title": u"Instagram photo by @videoseconds"
  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. }]