]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/vidlii.py
3 from .common
import InfoExtractor
17 class VidLiiIE(InfoExtractor
):
18 _VALID_URL
= r
'https?://(?:www\.)?vidlii\.com/(?:watch|embed)\?.*?\bv=(?P<id>[0-9A-Za-z_-]{11})'
20 'url': 'https://www.vidlii.com/watch?v=tJluaH4BJ3v',
21 'md5': '9bf7d1e005dfa909b6efb0a1ff5175e2',
25 'title': 'Vidlii is against me',
26 'description': 'md5:fa3f119287a2bfb922623b52b1856145',
27 'thumbnail': 're:https://.*.jpg',
28 'uploader': 'APPle5auc31995',
29 'uploader_url': 'https://www.vidlii.com/user/APPle5auc31995',
30 'upload_date': '20171107',
34 'average_rating': float,
35 'categories': ['News & Politics'],
36 'tags': ['Vidlii', 'Jan', 'Videogames'],
39 'url': 'https://www.vidlii.com/watch?v=zTAtaAgOLKt',
40 'md5': '5778f7366aa4c569b77002f8bf6b614f',
44 'title': 'FULPTUBE SUCKS.',
45 'description': 'md5:087b2ca355d4c8f8f77e97c43e72d711',
46 'thumbnail': 'https://www.vidlii.com/usfi/thmp/zTAtaAgOLKt.jpg',
47 'uploader': 'Homicide',
48 'uploader_url': 'https://www.vidlii.com/user/Homicide',
49 'upload_date': '20210612',
53 'average_rating': float,
54 'categories': ['News & Politics'],
55 'tags': ['fulp', 'tube', 'sucks', 'bad', 'fulptube'],
58 'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3v&a=0',
59 'only_matching': True,
62 def _real_extract(self
, url
):
63 video_id
= self
._match
_id
(url
)
65 webpage
= self
._download
_webpage
(
66 'https://www.vidlii.com/watch?v=%s' % video_id
, video_id
)
69 sources
= [source
[1] for source
in re
.findall(
70 r
'src\s*:\s*(["\'])(?P
<url
>(?
:https?
://)?
(?
:(?
!\
1).)+)\
1',
72 for source in sources:
73 height = int(self._search_regex(r'(\d
+).mp4
', source, 'height
', default=360))
74 if self._request_webpage(HEADRequest(source), video_id, f'Checking {height}p url
', errnote=False):
77 'format_id
': f'{height}p
',
81 title = self._search_regex(
82 (r'<h1
>([^
<]+)</h1
>', r'<title
>([^
<]+) - VidLii
<'), webpage,
85 description = self._html_search_meta(
86 ('description
', 'twitter
:description
'), webpage,
87 default=None) or strip_or_none(
88 get_element_by_id('des_text
', webpage))
90 thumbnail = self._html_search_meta(
91 'twitter
:image
', webpage, default=None)
93 thumbnail_path = self._search_regex(
94 r'img\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
95 'thumbnail', fatal=False, group='url')
97 thumbnail = urljoin(url, thumbnail_path)
99 uploader = self._search_regex(
100 r'<div[^>]+class=["\']wt_person
[^
>]+>\s
*<a
[^
>]+\bhref
=["\']/user/[^>]+>([^<]+)',
101 webpage, 'uploader', fatal=False)
102 uploader_url = format_field(uploader, None, 'https://www.vidlii.com/user/%s')
104 upload_date = unified_strdate(self._html_search_meta(
105 'datePublished', webpage, default=None) or self._search_regex(
106 r'<date>([^<]+)', webpage, 'upload date', fatal=False))
108 duration = int_or_none(self._html_search_meta(
109 'video:duration', webpage, 'duration',
110 default=None) or self._search_regex(
111 r'duration\s*:\s*(\d+)', webpage, 'duration', fatal=False))
113 view_count = str_to_int(self._search_regex(
114 (r'<strong>([,0-9]+)</strong> views',
115 r'Views\s*:\s*<strong>([,0-9]+)</strong>'),
116 webpage, 'view count', fatal=False))
118 comment_count = int_or_none(self._search_regex(
119 (r'<span[^>]+id=["\']cmt_num
[^
>]+>(\d
+)',
120 r'Comments\s
*:\s
*<strong
>(\d
+)'),
121 webpage, 'comment count
', fatal=False))
123 average_rating = float_or_none(self._search_regex(
124 r'rating\s
*:\s
*([\d
.]+)', webpage, 'average rating
', fatal=False))
126 category = self._html_search_regex(
127 r'<div
>Category\s
*:\s
*</div
>\s
*<div
>\s
*<a
[^
>]+>([^
<]+)', webpage,
128 'category
', fatal=False)
129 categories = [category] if category else None
133 for tag in re.findall(
134 r'<a
[^
>]+\bhref
=["\']/results\?.*?q=[^>]*>([^<]+)',
135 webpage) if strip_or_none(tag)
141 'description': description,
142 'thumbnail': thumbnail,
143 'uploader': uploader,
145 'uploader_url': uploader_url,
146 'upload_date': upload_date,
147 'duration': duration,
148 'view_count': view_count,
149 'comment_count': comment_count,
150 'average_rating': average_rating,
151 'categories': categories,