]> jfr.im git - yt-dlp.git/blame - youtube_dlc/extractor/cliphunter.py
Merge branch 'elonet' of https://github.com/tpikonen/youtube-dl into tpikonen-elonet
[yt-dlp.git] / youtube_dlc / extractor / cliphunter.py
CommitLineData
efc86777
PH
1from __future__ import unicode_literals
2
008af866 3from .common import InfoExtractor
432cd484
S
4from ..utils import (
5 int_or_none,
6 url_or_none,
7)
f54aee02
PH
8
9
008af866 10class CliphunterIE(InfoExtractor):
efc86777 11 IE_NAME = 'cliphunter'
008af866 12
5886b38d 13 _VALID_URL = r'''(?x)https?://(?:www\.)?cliphunter\.com/w/
b6d3a996
PH
14 (?P<id>[0-9]+)/
15 (?P<seo>.+?)(?:$|[#\?])
16 '''
aadd3ce2 17 _TESTS = [{
efc86777 18 'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
3e055aa5 19 'md5': 'b7c9bbd4eb3a226ab91093714dcaa480',
efc86777 20 'info_dict': {
f54aee02 21 'id': '1012420',
3e055aa5 22 'ext': 'flv',
efc86777 23 'title': 'Fun Jynx Maze solo',
ec85ded8 24 'thumbnail': r're:^https?://.*\.jpg$',
f54aee02 25 'age_limit': 18,
aadd3ce2
YCH
26 },
27 'skip': 'Video gone',
28 }, {
29 'url': 'http://www.cliphunter.com/w/2019449/ShesNew__My_booty_girlfriend_Victoria_Paradices_pussy_filled_with_jizz',
30 'md5': '55a723c67bfc6da6b0cfa00d55da8a27',
31 'info_dict': {
32 'id': '2019449',
33 'ext': 'mp4',
34 'title': 'ShesNew - My booty girlfriend, Victoria Paradice\'s pussy filled with jizz',
ec85ded8 35 'thumbnail': r're:^https?://.*\.jpg$',
aadd3ce2
YCH
36 'age_limit': 18,
37 },
38 }]
008af866
P
39
40 def _real_extract(self, url):
c9f08154 41 video_id = self._match_id(url)
008af866
P
42 webpage = self._download_webpage(url, video_id)
43
f54aee02
PH
44 video_title = self._search_regex(
45 r'mediaTitle = "([^"]+)"', webpage, 'title')
46
39fa4cc1
S
47 gexo_files = self._parse_json(
48 self._search_regex(
49 r'var\s+gexoFiles\s*=\s*({.+?});', webpage, 'gexo files'),
50 video_id)
3e055aa5
NJ
51
52 formats = []
39fa4cc1 53 for format_id, f in gexo_files.items():
432cd484 54 video_url = url_or_none(f.get('url'))
39fa4cc1
S
55 if not video_url:
56 continue
57 fmt = f.get('fmt')
58 height = f.get('h')
59 format_id = '%s_%sp' % (fmt, height) if fmt and height else format_id
60 formats.append({
432cd484 61 'url': video_url,
39fa4cc1
S
62 'format_id': format_id,
63 'width': int_or_none(f.get('w')),
64 'height': int_or_none(height),
65 'tbr': int_or_none(f.get('br')),
66 })
f54aee02
PH
67 self._sort_formats(formats)
68
69 thumbnail = self._search_regex(
70 r"var\s+mov_thumb\s*=\s*'([^']+)';",
71 webpage, 'thumbnail', fatal=False)
f54aee02 72
008af866
P
73 return {
74 'id': video_id,
75 'title': video_title,
76 'formats': formats,
f54aee02
PH
77 'age_limit': self._rta_search(webpage),
78 'thumbnail': thumbnail,
008af866 79 }