diff --git a/Makefile b/Makefile index a68da950fb..d1087a3b44 100644 --- a/Makefile +++ b/Makefile @@ -38,11 +38,13 @@ MANDIR ?= $(PREFIX)/man SHAREDIR ?= $(PREFIX)/share PYTHON ?= /usr/bin/env python3 -# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local -SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi) +# $(shell) and $(error) are no-ops in BSD Make and the != variable assignment operator is not supported by GNU Make <4.0 +VERSION_CHECK != echo supported +VERSION_CHECK ?= $(error GNU Make 4+ or BSD Make is required) +CHECK_VERSION := $(VERSION_CHECK) -# set markdown input format to "markdown-smart" for pandoc version 2 and to "markdown" for pandoc prior to version 2 -MARKDOWN = $(shell if [ `pandoc -v | head -n1 | cut -d" " -f2 | head -c1` = "2" ]; then echo markdown-smart; else echo markdown; fi) +# set markdown input format to "markdown-smart" for pandoc version 2+ and to "markdown" for pandoc prior to version 2 +MARKDOWN != if [ "`pandoc -v | head -n1 | cut -d' ' -f2 | head -c1`" -ge "2" ]; then echo markdown-smart; else echo markdown; fi install: lazy-extractors yt-dlp yt-dlp.1 completions mkdir -p $(DESTDIR)$(BINDIR) @@ -74,17 +76,17 @@ test: offlinetest: codetest $(PYTHON) -m pytest -k "not download" -CODE_FOLDERS := $(shell find yt_dlp -type d -not -name '__*' -exec sh -c 'test -e "$$1"/__init__.py' sh {} \; -print) -CODE_FILES := $(shell for f in $(CODE_FOLDERS); do echo "$$f" | awk '{gsub(/\/[^\/]+/,"/*"); print $$1"/*.py"}'; done | sort -u) +CODE_FOLDERS != find yt_dlp -type f -name '__init__.py' -exec dirname {} \+ | grep -v '/__' | sort +CODE_FILES != for f in $(CODE_FOLDERS) ; do echo "$$f" | sed 's,$$,/*.py,' ; done yt-dlp: $(CODE_FILES) mkdir -p zip for d in $(CODE_FOLDERS) ; do \ mkdir -p zip/$$d ;\ cp -pPR $$d/*.py zip/$$d/ ;\ done - cd zip ; touch -t 200001010101 $(CODE_FILES) + (cd zip && touch -t 200001010101 $(CODE_FILES)) mv zip/yt_dlp/__main__.py zip/ - cd zip ; zip -q ../yt-dlp $(CODE_FILES) __main__.py + (cd zip && zip -q ../yt-dlp $(CODE_FILES) __main__.py) rm -rf zip echo '#!$(PYTHON)' > yt-dlp cat yt-dlp.zip >> yt-dlp @@ -128,7 +130,7 @@ completions/fish/yt-dlp.fish: $(CODE_FILES) devscripts/fish-completion.in mkdir -p completions/fish $(PYTHON) devscripts/fish-completion.py -_EXTRACTOR_FILES = $(shell find yt_dlp/extractor -name '*.py' -and -not -name 'lazy_extractors.py') +_EXTRACTOR_FILES != find yt_dlp/extractor -name '*.py' -and -not -name 'lazy_extractors.py' yt_dlp/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES) $(PYTHON) devscripts/make_lazy_extractors.py $@ @@ -142,6 +144,7 @@ yt-dlp.tar.gz: all --exclude '__pycache__' \ --exclude '.*_cache' \ --exclude '.git' \ + --exclude '__pyinstaller' \ -- \ README.md supportedsites.md Changelog.md LICENSE \ CONTRIBUTING.md Collaborators.md CONTRIBUTORS AUTHORS \ diff --git a/yt_dlp/extractor/lefigaro.py b/yt_dlp/extractor/lefigaro.py index 9465095db4..a452d87062 100644 --- a/yt_dlp/extractor/lefigaro.py +++ b/yt_dlp/extractor/lefigaro.py @@ -13,7 +13,7 @@ class LeFigaroVideoEmbedIE(InfoExtractor): _TESTS = [{ 'url': 'https://video.lefigaro.fr/embed/figaro/video/les-francais-ne-veulent-ils-plus-travailler-suivez-en-direct-le-club-le-figaro-idees/', - 'md5': 'e94de44cd80818084352fcf8de1ce82c', + 'md5': 'a0c3069b7e4c4526abf0053a7713f56f', 'info_dict': { 'id': 'g9j7Eovo', 'title': 'Les Français ne veulent-ils plus travailler ? Retrouvez Le Club Le Figaro Idées', @@ -26,7 +26,7 @@ class LeFigaroVideoEmbedIE(InfoExtractor): }, }, { 'url': 'https://video.lefigaro.fr/embed/figaro/video/intelligence-artificielle-faut-il-sen-mefier/', - 'md5': '0b3f10332b812034b3a3eda1ef877c5f', + 'md5': '319c662943dd777bab835cae1e2d73a5', 'info_dict': { 'id': 'LeAgybyc', 'title': 'Intelligence artificielle : faut-il s’en méfier ?', @@ -41,7 +41,7 @@ class LeFigaroVideoEmbedIE(InfoExtractor): _WEBPAGE_TESTS = [{ 'url': 'https://video.lefigaro.fr/figaro/video/suivez-en-direct-le-club-le-figaro-international-avec-philippe-gelie-9/', - 'md5': '3972ddf2d5f8b98699f191687258e2f9', + 'md5': '6289f9489efb969e38245f31721596fe', 'info_dict': { 'id': 'QChnbPYA', 'title': 'Où en est le couple franco-allemand ? Retrouvez Le Club Le Figaro International', @@ -55,7 +55,7 @@ class LeFigaroVideoEmbedIE(InfoExtractor): }, }, { 'url': 'https://video.lefigaro.fr/figaro/video/la-philosophe-nathalie-sarthou-lajus-est-linvitee-du-figaro-live/', - 'md5': '3ac0a0769546ee6be41ab52caea5d9a9', + 'md5': 'f6df814cae53e85937621599d2967520', 'info_dict': { 'id': 'QJzqoNbf', 'title': 'La philosophe Nathalie Sarthou-Lajus est l’invitée du Figaro Live', @@ -73,7 +73,8 @@ def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - player_data = self._search_nextjs_data(webpage, display_id)['props']['pageProps']['pageData']['playerData'] + player_data = self._search_nextjs_data( + webpage, display_id)['props']['pageProps']['initialProps']['pageData']['playerData'] return self.url_result( f'jwplatform:{player_data["videoId"]}', title=player_data.get('title'), diff --git a/yt_dlp/extractor/magellantv.py b/yt_dlp/extractor/magellantv.py index 0947a450a6..6f2524ba22 100644 --- a/yt_dlp/extractor/magellantv.py +++ b/yt_dlp/extractor/magellantv.py @@ -28,12 +28,24 @@ class MagellanTVIE(InfoExtractor): 'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'], }, 'params': {'skip_download': 'm3u8'}, + }, { + 'url': 'https://www.magellantv.com/watch/celebration-nation', + 'info_dict': { + 'id': 'celebration-nation', + 'ext': 'mp4', + 'tags': ['Art & Culture', 'Human Interest', 'Anthropology', 'China', 'History'], + 'duration': 2640.0, + 'title': 'Ancestors', + }, + 'params': {'skip_download': 'm3u8'}, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - data = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['reactContext']['video']['detail'] + data = traverse_obj(self._search_nextjs_data(webpage, video_id), ( + 'props', 'pageProps', 'reactContext', + (('video', 'detail'), ('series', 'currentEpisode')), {dict}), get_all=False) formats, subtitles = self._extract_m3u8_formats_and_subtitles(data['jwpVideoUrl'], video_id) return {