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.

49 lines
1.6 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. _TESTS = [{
  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. 'url': 'http://footyroom.com/georgia-0-2-germany-2015-03/',
  15. 'info_dict': {
  16. 'id': 'georgia-0-2-germany-2015-03',
  17. 'title': 'Georgia 0 – 2 Germany',
  18. },
  19. 'playlist_count': 1,
  20. }]
  21. def _real_extract(self, url):
  22. playlist_id = self._match_id(url)
  23. webpage = self._download_webpage(url, playlist_id)
  24. playlist = self._parse_json(
  25. self._search_regex(
  26. r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'),
  27. playlist_id)
  28. playlist_title = self._og_search_title(webpage)
  29. entries = []
  30. for video in playlist:
  31. payload = video.get('payload')
  32. if not payload:
  33. continue
  34. playwire_url = self._search_regex(
  35. r'data-config="([^"]+)"', payload,
  36. 'playwire url', default=None)
  37. if playwire_url:
  38. entries.append(self.url_result(self._proto_relative_url(
  39. playwire_url, 'http:'), 'Playwire'))
  40. return self.playlist_result(entries, playlist_id, playlist_title)