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