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. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class IconosquareIE(InfoExtractor):
  4. _VALID_URL = r'https?://(www\.)?(?:iconosquare\.com|statigr\.am)/p/(?P<id>[^/]+)'
  5. _TEST = {
  6. 'url': 'http://statigr.am/p/522207370455279102_24101272',
  7. 'md5': '6eb93b882a3ded7c378ee1d6884b1814',
  8. 'info_dict': {
  9. 'id': '522207370455279102_24101272',
  10. 'ext': 'mp4',
  11. 'uploader_id': 'aguynamedpatrick',
  12. 'title': 'Instagram photo by @aguynamedpatrick (Patrick Janelle)',
  13. 'description': 'md5:644406a9ec27457ed7aa7a9ebcd4ce3d',
  14. },
  15. }
  16. def _real_extract(self, url):
  17. video_id = self._match_id(url)
  18. webpage = self._download_webpage(url, video_id)
  19. title = self._html_search_regex(
  20. r'<title>(.+?)(?: *\(Videos?\))? \| (?:Iconosquare|Statigram)</title>',
  21. webpage, 'title')
  22. uploader_id = self._html_search_regex(
  23. r'@([^ ]+)', title, 'uploader name', fatal=False)
  24. return {
  25. 'id': video_id,
  26. 'url': self._og_search_video_url(webpage),
  27. 'title': title,
  28. 'description': self._og_search_description(webpage),
  29. 'thumbnail': self._og_search_thumbnail(webpage),
  30. 'uploader_id': uploader_id
  31. }