logo

youtube-dl

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

weiqitv.py (1681B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class WeiqiTVIE(InfoExtractor):
  5. IE_DESC = 'WQTV'
  6. _VALID_URL = r'https?://(?:www\.)?weiqitv\.com/index/video_play\?videoId=(?P<id>[A-Za-z0-9]+)'
  7. _TESTS = [{
  8. 'url': 'http://www.weiqitv.com/index/video_play?videoId=53c744f09874f0e76a8b46f3',
  9. 'md5': '26450599afd64c513bc77030ad15db44',
  10. 'info_dict': {
  11. 'id': '53c744f09874f0e76a8b46f3',
  12. 'ext': 'mp4',
  13. 'title': '2013年度盘点',
  14. },
  15. }, {
  16. 'url': 'http://www.weiqitv.com/index/video_play?videoId=567379a2d4c36cca518b4569',
  17. 'info_dict': {
  18. 'id': '567379a2d4c36cca518b4569',
  19. 'ext': 'mp4',
  20. 'title': '民国围棋史',
  21. },
  22. }, {
  23. 'url': 'http://www.weiqitv.com/index/video_play?videoId=5430220a9874f088658b4567',
  24. 'info_dict': {
  25. 'id': '5430220a9874f088658b4567',
  26. 'ext': 'mp4',
  27. 'title': '二路托过的手段和运用',
  28. },
  29. }]
  30. def _real_extract(self, url):
  31. media_id = self._match_id(url)
  32. page = self._download_webpage(url, media_id)
  33. info_json_str = self._search_regex(
  34. r'var\s+video\s*=\s*(.+});', page, 'info json str')
  35. info_json = self._parse_json(info_json_str, media_id)
  36. letvcloud_url = self._search_regex(
  37. r'var\s+letvurl\s*=\s*"([^"]+)', page, 'letvcloud url')
  38. return {
  39. '_type': 'url_transparent',
  40. 'ie_key': 'LetvCloud',
  41. 'url': letvcloud_url,
  42. 'title': info_json['name'],
  43. 'id': media_id,
  44. }