Compare commits

..

3 Commits

Author SHA1 Message Date
bashonly
38bb163fe1
revert supportedsites.md 2024-01-22 20:52:48 +00:00
Ron Gomes
5ef4ef2d59 Lint fix. 2024-01-22 15:19:46 -05:00
Ron Gomes
c46e6b9075 [ONF] Add extractor. 2024-01-22 14:56:30 -05:00
4 changed files with 42 additions and 79 deletions

View File

@ -493,7 +493,6 @@
- **gem.cbc.ca**: [*cbcgem*](## "netrc machine")
- **gem.cbc.ca:live**
- **gem.cbc.ca:playlist**
- **generic**: Generic downloader that works on some sites
- **Genius**
- **GeniusLyrics**
- **Gettr**
@ -1472,6 +1471,7 @@
- **TuneInPodcast**
- **TuneInPodcastEpisode**
- **TuneInStation**
- **Turbo**
- **tv.dfb.de**
- **TV2**
- **TV2Article**
@ -1601,7 +1601,6 @@
- **ViMP:Playlist**
- **Vine**
- **vine:user**
- **Viously**
- **Viqeo**
- **Viu**
- **viu:ott**: [*viu*](## "netrc machine")

View File

@ -1216,7 +1216,10 @@ from .nexx import (
NexxIE,
NexxEmbedIE,
)
from .nfb import NFBIE
from .nfb import (
NFBIE,
ONFIE,
)
from .nfhsnetwork import NFHSNetworkIE
from .nfl import (
NFLIE,
@ -1344,7 +1347,6 @@ from .onet import (
OnetMVPIE,
OnetPlIE,
)
from .onf import ONFIE
from .onionstudios import OnionStudiosIE
from .opencast import (
OpencastIE,

View File

@ -2,31 +2,17 @@ from .common import InfoExtractor
from ..utils import int_or_none
class NFBIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
'id': 'trafficopter',
'ext': 'mp4',
'title': 'Trafficopter',
'description': 'md5:060228455eb85cf88785c41656776bc0',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'Barrie Howells',
'release_year': 1972,
},
}]
class NFBBaseIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage('https://www.nfb.ca/film/%s/' % video_id, video_id)
webpage = self._download_webpage(f'https://{self.domain}/film/%s/' % video_id, video_id)
iframe = self._html_search_regex(
r'<[^>]+\bid=["\']player-iframe["\'][^>]*src=["\']([^"\']+)',
webpage, 'iframe', default=None, fatal=True)
if iframe.startswith('/'):
iframe = f'https://www.nfb.ca{iframe}'
iframe = f'https://{self.domain}{iframe}'
player = self._download_webpage(iframe, video_id)
@ -56,3 +42,37 @@ class NFBIE(InfoExtractor):
'formats': formats,
'subtitles': subtitles,
}
class NFBIE(NFBBaseIE):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
'id': 'trafficopter',
'ext': 'mp4',
'title': 'Trafficopter',
'description': 'md5:060228455eb85cf88785c41656776bc0',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'Barrie Howells',
'release_year': 1972,
},
}]
domain = 'www.nfb.ca'
class ONFIE(NFBBaseIE):
_VALID_URL = r'https?://(?:www\.)?onf\.ca/film/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.onf.ca/film/mal-du-siecle/',
'info_dict': {
'id': 'mal-du-siecle',
'ext': 'mp4',
'title': 'Le mal du siècle',
'description': 'md5:1abf774d77569ebe603419f2d344102b',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'Catherine Lepage',
'release_year': 2019
},
}]
domain = 'www.onf.ca'

View File

@ -1,58 +0,0 @@
from .common import InfoExtractor
from ..utils import int_or_none
class ONFIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?onf\.ca/film/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.onf.ca/film/mal-du-siecle/',
'info_dict': {
'id': 'mal-du-siecle',
'ext': 'mp4',
'title': 'Le mal du siècle',
'description': 'md5:1abf774d77569ebe603419f2d344102b',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'Catherine Lepage',
'release_year': 2019
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage('https://www.onf.ca/film/%s/' % video_id, video_id)
iframe = self._html_search_regex(
r'<[^>]+\bid=["\']player-iframe["\'][^>]*src=["\']([^"\']+)',
webpage, 'iframe', default=None, fatal=True)
if iframe.startswith('/'):
iframe = f'https://www.onf.ca{iframe}'
player = self._download_webpage(iframe, video_id)
source = self._html_search_regex(
r'source:\s*\'([^\']+)',
player, 'source', default=None, fatal=True)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(source, video_id, ext='mp4')
return {
'id': video_id,
'title': self._html_search_regex(
r'<[^>]+\bid=["\']titleHeader["\'][^>]*>\s*<h1[^>]*>\s*([^<]+?)\s*</h1>',
webpage, 'title', default=None),
'description': self._html_search_regex(
r'<[^>]+\bid=["\']tabSynopsis["\'][^>]*>\s*<p[^>]*>\s*([^<]+)',
webpage, 'description', default=None),
'thumbnail': self._html_search_regex(
r'poster:\s*\'([^\']+)',
player, 'thumbnail', default=None),
'uploader': self._html_search_regex(
r'<[^>]+\bitemprop=["\']name["\'][^>]*>([^<]+)',
webpage, 'uploader', default=None),
'release_year': int_or_none(self._html_search_regex(
r'<[^>]+\bitemprop=["\']datePublished["\'][^>]*>([^<]+)',
webpage, 'release_year', default=None)),
'formats': formats,
'subtitles': subtitles,
}