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.

41 lines
1.3 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class FootyRoomIE(InfoExtractor):
  5. _VALID_URL = r'http://footyroom\.com/(?P<id>[^/]+)'
  6. _TEST = {
  7. 'url': 'http://footyroom.com/schalke-04-0-2-real-madrid-2015-02/',
  8. 'info_dict': {
  9. 'id': 'schalke-04-0-2-real-madrid-2015-02',
  10. 'title': 'Schalke 04 0 – 2 Real Madrid',
  11. },
  12. 'playlist_count': 3,
  13. }
  14. def _real_extract(self, url):
  15. playlist_id = self._match_id(url)
  16. webpage = self._download_webpage(url, playlist_id)
  17. playlist = self._parse_json(
  18. self._search_regex(
  19. r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'),
  20. playlist_id)
  21. playlist_title = self._og_search_title(webpage)
  22. entries = []
  23. for video in playlist:
  24. payload = video.get('payload')
  25. if not payload:
  26. continue
  27. playwire_url = self._search_regex(
  28. r'data-config="([^"]+)"', payload,
  29. 'playwire url', default=None)
  30. if playwire_url:
  31. entries.append(self.url_result(playwire_url, 'Playwire'))
  32. return self.playlist_result(entries, playlist_id, playlist_title)