]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ku6.py
Prepare new version
[youtubedl] / youtube_dl / extractor / ku6.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class Ku6IE(InfoExtractor):
7 _VALID_URL = r'https?://v\.ku6\.com/show/(?P<id>[a-zA-Z0-9\-\_]+)(?:\.)*html'
8 _TEST = {
9 'url': 'http://v.ku6.com/show/JG-8yS14xzBr4bCn1pu0xw...html',
10 'md5': '01203549b9efbb45f4b87d55bdea1ed1',
11 'info_dict': {
12 'id': 'JG-8yS14xzBr4bCn1pu0xw',
13 'ext': 'f4v',
14 'title': 'techniques test',
15 }
16 }
17
18 def _real_extract(self, url):
19 video_id = self._match_id(url)
20 webpage = self._download_webpage(url, video_id)
21
22 title = self._html_search_regex(
23 r'<h1 title=.*>(.*?)</h1>', webpage, 'title')
24 dataUrl = 'http://v.ku6.com/fetchVideo4Player/%s.html' % video_id
25 jsonData = self._download_json(dataUrl, video_id)
26 downloadUrl = jsonData['data']['f']
27
28 return {
29 'id': video_id,
30 'title': title,
31 'url': downloadUrl
32 }