logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

footyroom.py (1875B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from .streamable import StreamableIE
  5. class FootyRoomIE(InfoExtractor):
  6. _VALID_URL = r'https?://footyroom\.com/matches/(?P<id>\d+)'
  7. _TESTS = [{
  8. 'url': 'http://footyroom.com/matches/79922154/hull-city-vs-chelsea/review',
  9. 'info_dict': {
  10. 'id': '79922154',
  11. 'title': 'VIDEO Hull City 0 - 2 Chelsea',
  12. },
  13. 'playlist_count': 2,
  14. 'add_ie': [StreamableIE.ie_key()],
  15. }, {
  16. 'url': 'http://footyroom.com/matches/75817984/georgia-vs-germany/review',
  17. 'info_dict': {
  18. 'id': '75817984',
  19. 'title': 'VIDEO Georgia 0 - 2 Germany',
  20. },
  21. 'playlist_count': 1,
  22. 'add_ie': ['Playwire']
  23. }]
  24. def _real_extract(self, url):
  25. playlist_id = self._match_id(url)
  26. webpage = self._download_webpage(url, playlist_id)
  27. playlist = self._parse_json(self._search_regex(
  28. r'DataStore\.media\s*=\s*([^;]+)', webpage, 'media data'),
  29. playlist_id)
  30. playlist_title = self._og_search_title(webpage)
  31. entries = []
  32. for video in playlist:
  33. payload = video.get('payload')
  34. if not payload:
  35. continue
  36. playwire_url = self._html_search_regex(
  37. r'data-config="([^"]+)"', payload,
  38. 'playwire url', default=None)
  39. if playwire_url:
  40. entries.append(self.url_result(self._proto_relative_url(
  41. playwire_url, 'http:'), 'Playwire'))
  42. streamable_url = StreamableIE._extract_url(payload)
  43. if streamable_url:
  44. entries.append(self.url_result(
  45. streamable_url, StreamableIE.ie_key()))
  46. return self.playlist_result(entries, playlist_id, playlist_title)