ku6.py 957 B

123456789101112131415161718192021222324252627282930
  1. from .common import InfoExtractor
  2. class Ku6IE(InfoExtractor):
  3. _VALID_URL = r'https?://v\.ku6\.com/show/(?P<id>[a-zA-Z0-9\-\_]+)(?:\.)*html'
  4. _TEST = {
  5. 'url': 'http://v.ku6.com/show/JG-8yS14xzBr4bCn1pu0xw...html',
  6. 'md5': '01203549b9efbb45f4b87d55bdea1ed1',
  7. 'info_dict': {
  8. 'id': 'JG-8yS14xzBr4bCn1pu0xw',
  9. 'ext': 'f4v',
  10. 'title': 'techniques test',
  11. },
  12. }
  13. def _real_extract(self, url):
  14. video_id = self._match_id(url)
  15. webpage = self._download_webpage(url, video_id)
  16. title = self._html_search_regex(
  17. r'<h1 title=.*>(.*?)</h1>', webpage, 'title')
  18. data_url = f'http://v.ku6.com/fetchVideo4Player/{video_id}.html'
  19. json_data = self._download_json(data_url, video_id)
  20. download_url = json_data['data']['f']
  21. return {
  22. 'id': video_id,
  23. 'title': title,
  24. 'url': download_url,
  25. }