[VidLii] Add 720p support (#1681)

Authored by: mrpapersonic
This commit is contained in:
Paper 2021-11-19 01:11:36 -05:00 committed by GitHub
parent a04e005521
commit 7333296ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,11 @@ import re
from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
get_element_by_id,
int_or_none,
str_to_int,
strip_or_none,
unified_strdate,
urljoin,
@ -35,6 +37,25 @@ class VidLiiIE(InfoExtractor):
'categories': ['News & Politics'],
'tags': ['Vidlii', 'Jan', 'Videogames'],
}
}, {
'url': 'https://www.vidlii.com/watch?v=zTAtaAgOLKt',
'md5': '5778f7366aa4c569b77002f8bf6b614f',
'info_dict': {
'id': 'zTAtaAgOLKt',
'ext': 'mp4',
'title': 'FULPTUBE SUCKS.',
'description': 'md5:087b2ca355d4c8f8f77e97c43e72d711',
'thumbnail': 'https://www.vidlii.com/usfi/thmp/zTAtaAgOLKt.jpg',
'uploader': 'Homicide',
'uploader_url': 'https://www.vidlii.com/user/Homicide',
'upload_date': '20210612',
'duration': 89,
'view_count': int,
'comment_count': int,
'average_rating': float,
'categories': ['News & Politics'],
'tags': ['fulp', 'tube', 'sucks', 'bad', 'fulptube'],
},
}, {
'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3v&a=0',
'only_matching': True,
@ -45,10 +66,20 @@ class VidLiiIE(InfoExtractor):
webpage = self._download_webpage(
'https://www.vidlii.com/watch?v=%s' % video_id, video_id)
formats = []
video_url = self._search_regex(
r'src\s*:\s*(["\'])(?P<url>(?:https?://)?(?:(?!\1).)+)\1', webpage,
'video url', group='url')
sources = [source[1] for source in re.findall(
r'src\s*:\s*(["\'])(?P<url>(?:https?://)?(?:(?!\1).)+)\1',
webpage) or []]
for source in sources:
height = int(self._search_regex(r'(\d+).mp4', source, 'height', default=360))
if self._request_webpage(HEADRequest(source), video_id, f'Checking {height}p url', errnote=False):
formats.append({
'url': source,
'format_id': f'{height}p',
'height': height,
})
self._sort_formats(formats)
title = self._search_regex(
(r'<h1>([^<]+)</h1>', r'<title>([^<]+) - VidLii<'), webpage,
@ -82,9 +113,9 @@ class VidLiiIE(InfoExtractor):
default=None) or self._search_regex(
r'duration\s*:\s*(\d+)', webpage, 'duration', fatal=False))
view_count = int_or_none(self._search_regex(
(r'<strong>(\d+)</strong> views',
r'Views\s*:\s*<strong>(\d+)</strong>'),
view_count = str_to_int(self._search_regex(
(r'<strong>([,0-9]+)</strong> views',
r'Views\s*:\s*<strong>([,0-9]+)</strong>'),
webpage, 'view count', fatal=False))
comment_count = int_or_none(self._search_regex(
@ -109,11 +140,11 @@ class VidLiiIE(InfoExtractor):
return {
'id': video_id,
'url': video_url,
'title': title,
'description': description,
'thumbnail': thumbnail,
'uploader': uploader,
'formats': formats,
'uploader_url': uploader_url,
'upload_date': upload_date,
'duration': duration,