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.

33 lines
1.1 KiB

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