mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-06 23:41:26 +01:00
Compare commits
4 Commits
68161d4a42
...
0de2b61016
Author | SHA1 | Date | |
---|---|---|---|
|
0de2b61016 | ||
|
6e681fdfef | ||
|
9d88a2f105 | ||
|
f0b45518db |
|
@ -4,6 +4,7 @@ from .common import InfoExtractor
|
|||
from .archiveorg import ArchiveOrgIE
|
||||
from ..utils import (
|
||||
int_or_none,
|
||||
str_to_int,
|
||||
orderedSet,
|
||||
urljoin,
|
||||
InAdvancePagedList,
|
||||
|
@ -16,9 +17,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',
|
||||
|
@ -37,16 +38,12 @@ 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 = 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
|
||||
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])
|
||||
|
||||
|
||||
class AltCensoredChannelIE(InfoExtractor):
|
||||
|
|
Loading…
Reference in New Issue
Block a user