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