Compare commits

..

No commits in common. "0de2b61016b951a3726d0611f09417b4921c8164" and "68161d4a42ebffd7700e9a6d4743d6a9dd7cc82a" have entirely different histories.

View File

@ -4,7 +4,6 @@ from .common import InfoExtractor
from .archiveorg import ArchiveOrgIE from .archiveorg import ArchiveOrgIE
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
str_to_int,
orderedSet, orderedSet,
urljoin, urljoin,
InAdvancePagedList, InAdvancePagedList,
@ -17,9 +16,9 @@ class AltCensoredIE(InfoExtractor):
_TESTS = [{ _TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8', 'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': { 'info_dict': {
'id': 'youtube-k0srjLSkga8', "id": "youtube-k0srjLSkga8",
'ext': 'webm', "ext": "webm",
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?", "title": "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm', 'display_id': 'k0srjLSkga8.webm',
'release_date': '20180403', 'release_date': '20180403',
'creator': 'Virginie Vota', 'creator': 'Virginie Vota',
@ -38,12 +37,16 @@ class AltCensoredIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(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) 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='')) yt_views = int_or_none(self._html_search_regex(
category = self._html_search_regex(r'<a href="/category/\d+">\s*\n?\s*([^<]+)</a>', webpage, 'category', fatal=False) r'YouTube Views:.*?([0-9,.]+)', webpage, 'view count', default='0').replace(',', ''))
category = self._html_search_regex(r'<a href="/category/.*?\n\s+([^<]+)', webpage, 'category')
return self.url_result(f'https://archive.org/details/youtube-{video_id}', ArchiveOrgIE, url_transparent=True, # Hardcoded (very unlikely to need a change in a foreseeable future)
view_count=yt_views, categories=[category]) 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): class AltCensoredChannelIE(InfoExtractor):