weiqitv.py 1.6 KB

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