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.

32 lines
1.0 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from .ooyala import OoyalaIE
  5. class TheSunIE(InfoExtractor):
  6. _VALID_URL = r'https://(?:www\.)?thesun\.co\.uk/[^/]+/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'https://www.thesun.co.uk/tvandshowbiz/2261604/orlando-bloom-and-katy-perry-post-adorable-instagram-video-together-celebrating-thanksgiving-after-split-rumours/',
  9. 'info_dict': {
  10. 'id': '2261604',
  11. 'title': 'md5:cba22f48bad9218b64d5bbe0e16afddf',
  12. },
  13. 'playlist_count': 2,
  14. }
  15. def _real_extract(self, url):
  16. article_id = self._match_id(url)
  17. webpage = self._download_webpage(url, article_id)
  18. entries = []
  19. for ooyala_id in re.findall(
  20. r'<[^>]+\b(?:id\s*=\s*"thesun-ooyala-player-|data-content-id\s*=\s*")([^"]+)',
  21. webpage):
  22. entries.append(OoyalaIE._build_url_result(ooyala_id))
  23. return self.playlist_result(
  24. entries, article_id, self._og_search_title(webpage, fatal=False))