]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/vidlii.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
20 class VidLiiIE(InfoExtractor
):
21 _VALID_URL
= r
'https?://(?:www\.)?vidlii\.com/(?:watch|embed)\?.*?\bv=(?P<id>[0-9A-Za-z_-]{11})'
23 'url': 'https://www.vidlii.com/watch?v=tJluaH4BJ3v',
24 'md5': '9bf7d1e005dfa909b6efb0a1ff5175e2',
28 'title': 'Vidlii is against me',
29 'description': 'md5:fa3f119287a2bfb922623b52b1856145',
30 'thumbnail': 're:https://.*.jpg',
31 'uploader': 'APPle5auc31995',
32 'uploader_url': 'https://www.vidlii.com/user/APPle5auc31995',
33 'upload_date': '20171107',
37 'average_rating': float,
38 'categories': ['News & Politics'],
39 'tags': ['Vidlii', 'Jan', 'Videogames'],
42 'url': 'https://www.vidlii.com/watch?v=zTAtaAgOLKt',
43 'md5': '5778f7366aa4c569b77002f8bf6b614f',
47 'title': 'FULPTUBE SUCKS.',
48 'description': 'md5:087b2ca355d4c8f8f77e97c43e72d711',
49 'thumbnail': 'https://www.vidlii.com/usfi/thmp/zTAtaAgOLKt.jpg',
50 'uploader': 'Homicide',
51 'uploader_url': 'https://www.vidlii.com/user/Homicide',
52 'upload_date': '20210612',
56 'average_rating': float,
57 'categories': ['News & Politics'],
58 'tags': ['fulp', 'tube', 'sucks', 'bad', 'fulptube'],
61 'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3v&a=0',
62 'only_matching': True,
65 def _real_extract(self
, url
):
66 video_id
= self
._match
_id
(url
)
68 webpage
= self
._download
_webpage
(
69 'https://www.vidlii.com/watch?v=%s' % video_id
, video_id
)
72 sources
= [source
[1] for source
in re
.findall(
73 r
'src\s*:\s*(["\'])(?P
<url
>(?
:https?
://)?
(?
:(?
!\
1).)+)\
1',
75 for source in sources:
76 height = int(self._search_regex(r'(\d
+).mp4
', source, 'height
', default=360))
77 if self._request_webpage(HEADRequest(source), video_id, f'Checking {height}p url
', errnote=False):
80 'format_id
': f'{height}p
',
83 self._sort_formats(formats)
85 title = self._search_regex(
86 (r'<h1
>([^
<]+)</h1
>', r'<title
>([^
<]+) - VidLii
<'), webpage,
89 description = self._html_search_meta(
90 ('description
', 'twitter
:description
'), webpage,
91 default=None) or strip_or_none(
92 get_element_by_id('des_text
', webpage))
94 thumbnail = self._html_search_meta(
95 'twitter
:image
', webpage, default=None)
97 thumbnail_path = self._search_regex(
98 r'img\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
99 'thumbnail', fatal=False, group='url')
101 thumbnail = urljoin(url, thumbnail_path)
103 uploader = self._search_regex(
104 r'<div[^>]+class=["\']wt_person
[^
>]+>\s
*<a
[^
>]+\bhref
=["\']/user/[^>]+>([^<]+)',
105 webpage, 'uploader', fatal=False)
106 uploader_url = format_field(uploader, template='https://www.vidlii.com/user/%s')
108 upload_date = unified_strdate(self._html_search_meta(
109 'datePublished', webpage, default=None) or self._search_regex(
110 r'<date>([^<]+)', webpage, 'upload date', fatal=False))
112 duration = int_or_none(self._html_search_meta(
113 'video:duration', webpage, 'duration',
114 default=None) or self._search_regex(
115 r'duration\s*:\s*(\d+)', webpage, 'duration', fatal=False))
117 view_count = str_to_int(self._search_regex(
118 (r'<strong>([,0-9]+)</strong> views',
119 r'Views\s*:\s*<strong>([,0-9]+)</strong>'),
120 webpage, 'view count', fatal=False))
122 comment_count = int_or_none(self._search_regex(
123 (r'<span[^>]+id=["\']cmt_num
[^
>]+>(\d
+)',
124 r'Comments\s
*:\s
*<strong
>(\d
+)'),
125 webpage, 'comment count
', fatal=False))
127 average_rating = float_or_none(self._search_regex(
128 r'rating\s
*:\s
*([\d
.]+)', webpage, 'average rating
', fatal=False))
130 category = self._html_search_regex(
131 r'<div
>Category\s
*:\s
*</div
>\s
*<div
>\s
*<a
[^
>]+>([^
<]+)', webpage,
132 'category
', fatal=False)
133 categories = [category] if category else None
137 for tag in re.findall(
138 r'<a
[^
>]+\bhref
=["\']/results\?.*?q=[^>]*>([^<]+)',
139 webpage) if strip_or_none(tag)
145 'description': description,
146 'thumbnail': thumbnail,
147 'uploader': uploader,
149 'uploader_url': uploader_url,
150 'upload_date': upload_date,
151 'duration': duration,
152 'view_count': view_count,
153 'comment_count': comment_count,
154 'average_rating': average_rating,
155 'categories': categories,