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.

35 lines
1.0 KiB

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