~facundo/encuentro/trunk

« back to all changes in this revision

Viewing changes to external/youtube-dl/youtube_dl/extractor/ku6.py

  • Committer: Facundo Batista
  • Date: 2015-12-27 11:27:15 UTC
  • mto: This revision was merged to the branch mainline in revision 274.
  • Revision ID: facundo@taniquetil.com.ar-20151227112715-ztuasdhqm26hycug
Able to download TEDx.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from __future__ import unicode_literals
 
2
 
 
3
from .common import InfoExtractor
 
4
 
 
5
 
 
6
class Ku6IE(InfoExtractor):
 
7
    _VALID_URL = r'http://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
        }