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.

69 lines
2.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class WallaIE(InfoExtractor):
  6. _VALID_URL = r'http://vod\.walla\.co\.il/\w+/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'http://vod.walla.co.il/movie/2642630/one-direction-all-for-one',
  9. 'info_dict': {
  10. 'id': '2642630',
  11. 'ext': 'flv',
  12. 'title': 'וואן דיירקשן: ההיסטריה',
  13. }
  14. }
  15. def _real_extract(self, url):
  16. mobj = re.match(self._VALID_URL, url)
  17. video_id = mobj.group('id')
  18. config_url = 'http://video2.walla.co.il/?w=null/null/%s/@@/video/flv_pl' % video_id
  19. webpage = self._download_webpage(config_url, video_id, '')
  20. media_id = self._html_search_regex(r'<media_id>(\d+)</media_id>', webpage, video_id, 'extract media id')
  21. prefix = '0' if len(media_id) == 7 else ''
  22. series = '%s%s' % (prefix, media_id[0:2])
  23. session = media_id[2:5]
  24. episode = media_id[5:7]
  25. title = self._html_search_regex(r'<title>(.*)</title>', webpage, video_id, 'title')
  26. default_quality = self._html_search_regex(r'<qualities defaultType="(\d+)">', webpage, video_id, 0)
  27. quality = default_quality if default_quality else '40'
  28. media_path = '/%s/%s/%s' % (series, session, media_id) #self._html_search_regex(r'<quality type="%s">.*<src>(.*)</src>' % default_quality ,webpage, '', flags=re.DOTALL)
  29. playpath = 'mp4:media/%s/%s/%s-%s' % (series, session, media_id, quality) #self._html_search_regex(r'<quality type="%s">.*<src>(.*)</src>' % default_quality ,webpage, '', flags=re.DOTALL)
  30. subtitles = {}
  31. subtitle_url = self._html_search_regex(r'<subtitles.*<src>(.*)</src>.*</subtitle>', webpage, video_id, 0)
  32. print subtitle_url
  33. if subtitle_url:
  34. subtitles_page = self._download_webpage(subtitle_url, video_id, '')
  35. subtitles['heb'] = subtitles_page
  36. return {
  37. 'id': video_id,
  38. 'title': title,
  39. 'url': 'rtmp://wafla.walla.co.il:1935/vod',
  40. 'player_url': 'http://isc.walla.co.il/w9/swf/video_swf/vod/WallaMediaPlayerAvod.swf',
  41. 'page_url': url,
  42. 'app': "vod",
  43. 'play_path': playpath,
  44. 'tc_url': 'rtmp://wafla.walla.co.il:1935/vod',
  45. 'rtmp_protocol': 'rtmp',
  46. 'ext': 'flv',
  47. 'subtitles': subtitles,
  48. }