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.

53 lines
1.9 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import unified_strdate, determine_ext
  5. class RoxwelIE(InfoExtractor):
  6. _VALID_URL = r'https?://www\.roxwel\.com/player/(?P<filename>.+?)(\.|\?|$)'
  7. _TEST = {
  8. 'url': 'http://www.roxwel.com/player/passionpittakeawalklive.html',
  9. 'info_dict': {
  10. 'id': 'passionpittakeawalklive',
  11. 'ext': 'flv',
  12. 'title': 'Take A Walk (live)',
  13. 'uploader': 'Passion Pit',
  14. 'uploader_id': 'passionpit',
  15. 'upload_date': '20120928',
  16. 'description': 'Passion Pit performs "Take A Walk\" live at The Backyard in Austin, Texas. ',
  17. },
  18. 'params': {
  19. # rtmp download
  20. 'skip_download': True,
  21. }
  22. }
  23. def _real_extract(self, url):
  24. mobj = re.match(self._VALID_URL, url)
  25. filename = mobj.group('filename')
  26. info_url = 'http://www.roxwel.com/api/videos/%s' % filename
  27. info = self._download_json(info_url, filename)
  28. rtmp_rates = sorted([int(r.replace('flv_', '')) for r in info['media_rates'] if r.startswith('flv_')])
  29. best_rate = rtmp_rates[-1]
  30. url_page_url = 'http://roxwel.com/pl_one_time.php?filename=%s&quality=%s' % (filename, best_rate)
  31. rtmp_url = self._download_webpage(url_page_url, filename, 'Downloading video url')
  32. ext = determine_ext(rtmp_url)
  33. if ext == 'f4v':
  34. rtmp_url = rtmp_url.replace(filename, 'mp4:%s' % filename)
  35. return {
  36. 'id': filename,
  37. 'title': info['title'],
  38. 'url': rtmp_url,
  39. 'ext': 'flv',
  40. 'description': info['description'],
  41. 'thumbnail': info.get('player_image_url') or info.get('image_url_large'),
  42. 'uploader': info['artist'],
  43. 'uploader_id': info['artistname'],
  44. 'upload_date': unified_strdate(info['dbdate']),
  45. }