mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 07:51:26 +01:00
Compare commits
No commits in common. "0de2b61016b951a3726d0611f09417b4921c8164" and "68161d4a42ebffd7700e9a6d4743d6a9dd7cc82a" have entirely different histories.
0de2b61016
...
68161d4a42
|
@ -4,7 +4,6 @@ from .common import InfoExtractor
|
|||
from .archiveorg import ArchiveOrgIE
|
||||
from ..utils import (
|
||||
int_or_none,
|
||||
str_to_int,
|
||||
orderedSet,
|
||||
urljoin,
|
||||
InAdvancePagedList,
|
||||
|
@ -17,9 +16,9 @@ class AltCensoredIE(InfoExtractor):
|
|||
_TESTS = [{
|
||||
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
|
||||
'info_dict': {
|
||||
'id': 'youtube-k0srjLSkga8',
|
||||
'ext': 'webm',
|
||||
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
|
||||
"id": "youtube-k0srjLSkga8",
|
||||
"ext": "webm",
|
||||
"title": "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
|
||||
'display_id': 'k0srjLSkga8.webm',
|
||||
'release_date': '20180403',
|
||||
'creator': 'Virginie Vota',
|
||||
|
@ -38,12 +37,16 @@ class AltCensoredIE(InfoExtractor):
|
|||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
# Use most data from archive.org (extractor indirection)
|
||||
# But try first to gather a couple of useful information from altcensored
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
yt_views = str_to_int(self._html_search_regex(r'YouTube Views:(?:\s| )*([\d,]+)', webpage, 'view count', default=''))
|
||||
category = self._html_search_regex(r'<a href="/category/\d+">\s*\n?\s*([^<]+)</a>', webpage, 'category', fatal=False)
|
||||
|
||||
return self.url_result(f'https://archive.org/details/youtube-{video_id}', ArchiveOrgIE, url_transparent=True,
|
||||
view_count=yt_views, categories=[category])
|
||||
yt_views = int_or_none(self._html_search_regex(
|
||||
r'YouTube Views:.*?([0-9,.]+)', webpage, 'view count', default='0').replace(',', ''))
|
||||
category = self._html_search_regex(r'<a href="/category/.*?\n\s+([^<]+)', webpage, 'category')
|
||||
# Hardcoded (very unlikely to need a change in a foreseeable future)
|
||||
res = self.url_result(f'https://archive.org/details/youtube-{video_id}', ArchiveOrgIE, url_transparent=True,
|
||||
yt_views=yt_views, category=category)
|
||||
return res
|
||||
|
||||
|
||||
class AltCensoredChannelIE(InfoExtractor):
|
||||
|
|
Loading…
Reference in New Issue
Block a user