3 from .common
import InfoExtractor
4 from ..networking
import HEADRequest
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 f
'https://www.vidlii.com/watch?v={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 source = urljoin(url, source)
74 height = int(self._search_regex(r'(\d
+).mp4
', source, 'height
', default=360))
75 if self._request_webpage(HEADRequest(source), video_id, f'Checking {height}p url
', errnote=False):
78 'format_id
': f'{height}p
',
82 title = self._search_regex(
83 (r'<h1
>([^
<]+)</h1
>', r'<title
>([^
<]+) - VidLii
<'), webpage,
86 description = self._html_search_meta(
87 ('description
', 'twitter
:description
'), webpage,
88 default=None) or strip_or_none(
89 get_element_by_id('des_text
', webpage))
91 thumbnail = self._html_search_meta(
92 'twitter
:image
', webpage, default=None)
94 thumbnail_path = self._search_regex(
95 r'img\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
96 'thumbnail', fatal=False, group='url')
98 thumbnail = urljoin(url, thumbnail_path)
100 uploader = self._search_regex(
101 r'<div[^>]+class=["\']wt_person
[^
>]+>\s
*<a
[^
>]+\bhref
=["\']/user/[^>]+>([^<]+)',
102 webpage, 'uploader', fatal=False)
103 uploader_url = format_field(uploader, None, 'https://www.vidlii.com/user/%s')
105 upload_date = unified_strdate(self._html_search_meta(
106 'datePublished', webpage, default=None) or self._search_regex(
107 r'<date>([^<]+)', webpage, 'upload date', fatal=False))
109 duration = int_or_none(self._html_search_meta(
110 'video:duration', webpage, 'duration',
111 default=None) or self._search_regex(
112 r'duration\s*:\s*(\d+)', webpage, 'duration', fatal=False))
114 view_count = str_to_int(self._search_regex(
115 (r'<strong>([,0-9]+)</strong> views',
116 r'Views\s*:\s*<strong>([,0-9]+)</strong>'),
117 webpage, 'view count', fatal=False))
119 comment_count = int_or_none(self._search_regex(
120 (r'<span[^>]+id=["\']cmt_num
[^
>]+>(\d
+)',
121 r'Comments\s
*:\s
*<strong
>(\d
+)'),
122 webpage, 'comment count
', fatal=False))
124 average_rating = float_or_none(self._search_regex(
125 r'rating\s
*:\s
*([\d
.]+)', webpage, 'average rating
', fatal=False))
127 category = self._html_search_regex(
128 r'<div
>Category\s
*:\s
*</div
>\s
*<div
>\s
*<a
[^
>]+>([^
<]+)', webpage,
129 'category
', fatal=False)
130 categories = [category] if category else None
134 for tag in re.findall(
135 r'<a
[^
>]+\bhref
=["\']/results\?.*?q=[^>]*>([^<]+)',
136 webpage) if strip_or_none(tag)
142 'description': description,
143 'thumbnail': thumbnail,
144 'uploader': uploader,
146 'uploader_url': uploader_url,
147 'upload_date': upload_date,
148 'duration': duration,
149 'view_count': view_count,
150 'comment_count': comment_count,
151 'average_rating': average_rating,
152 'categories': categories,