A feature-rich command-line audio/video downloader
[build] Enable lazy-extractors in releases
pukkandan6e21fdd27902
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 2963805961..9bcdc4f94c 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -51,6 +51,10 @@ jobs:echo "changelog<<EOF" >> $GITHUB_ENVecho "$changelog" >> $GITHUB_ENVecho "EOF" >> $GITHUB_ENV++ - name: Build lazy extractors+ id: lazy_extractors+ run: python devscripts/make_lazy_extractors.py yt_dlp/extractor/lazy_extractors.py- name: Run Makerun: make all tar- name: Get SHA2-256SUMS for yt-dlp@@ -155,6 +159,9 @@ jobs:run: python devscripts/update-version.py- name: Print versionrun: echo "${{ steps.bump_version.outputs.ytdlp_version }}"+ - name: Build lazy extractors+ id: lazy_extractors+ run: /usr/bin/python3 devscripts/make_lazy_extractors.py yt_dlp/extractor/lazy_extractors.py- name: Run PyInstaller Scriptrun: /usr/bin/python3 ./pyinst.py --target-architecture universal2 --onefile- name: Upload yt-dlp MacOS binary@@ -224,6 +231,9 @@ jobs:run: python devscripts/update-version.py- name: Print versionrun: echo "${{ steps.bump_version.outputs.ytdlp_version }}"+ - name: Build lazy extractors+ id: lazy_extractors+ run: python devscripts/make_lazy_extractors.py yt_dlp/extractor/lazy_extractors.py- name: Run PyInstaller Scriptrun: python pyinst.py- name: Upload yt-dlp.exe Windows binary@@ -290,6 +300,9 @@ jobs:run: python devscripts/update-version.py- name: Print versionrun: echo "${{ steps.bump_version.outputs.ytdlp_version }}"+ - name: Build lazy extractors+ id: lazy_extractors+ run: python devscripts/make_lazy_extractors.py yt_dlp/extractor/lazy_extractors.py- name: Run PyInstaller Script for 32 Bitrun: python pyinst.py- name: Upload Executable yt-dlp_x86.exediff --git a/Makefile b/Makefileindex e7b854a9d3..ee199e4486 100644--- a/Makefile+++ b/Makefile@@ -1,4 +1,4 @@-all: yt-dlp doc pypi-files+all: lazy-extractors yt-dlp doc pypi-filesclean: clean-test clean-dist clean-cachecompletions: completion-bash completion-fish completion-zshdoc: README.md CONTRIBUTING.md issuetemplates supportedsites@@ -40,7 +40,7 @@ SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then ech# set markdown input format to "markdown-smart" for pandoc version 2 and to "markdown" for pandoc prior to version 2MARKDOWN = $(shell if [ `pandoc -v | head -n1 | cut -d" " -f2 | head -c1` = "2" ]; then echo markdown-smart; else echo markdown; fi)-install: yt-dlp yt-dlp.1 completions+install: lazy_extractors yt-dlp yt-dlp.1 completionsinstall -Dm755 yt-dlp $(DESTDIR)$(BINDIR)install -Dm644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1install -Dm644 completions/bash/yt-dlp $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlpdiff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex 79f0b274d2..f95bbea81f 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -3268,8 +3268,11 @@ class YoutubeDL(object):source = detect_variant()write_debug('yt-dlp version %s%s\n' % (__version__, '' if source == 'unknown' else f' ({source})'))- if _LAZY_LOADER:- write_debug('Lazy loading extractors enabled\n')+ if not _LAZY_LOADER:+ if os.environ.get('YTDLP_NO_LAZY_EXTRACTORS'):+ write_debug('Lazy loading extractors is forcibly disabled\n')+ else:+ write_debug('Lazy loading extractors is disabled\n')if plugin_extractors or plugin_postprocessors:write_debug('Plugins: %s\n' % ['%s%s' % (klass.__name__, '' if klass.__name__ == name else f' as {name}')diff --git a/yt_dlp/extractor/__init__.py b/yt_dlp/extractor/__init__.pyindex 198c4ae17f..b35484246a 100644--- a/yt_dlp/extractor/__init__.py+++ b/yt_dlp/extractor/__init__.py@@ -1,14 +1,15 @@-from __future__ import unicode_literals+import osfrom ..utils import load_plugins-try:- from .lazy_extractors import *- from .lazy_extractors import _ALL_CLASSES- _LAZY_LOADER = True- _PLUGIN_CLASSES = {}-except ImportError:- _LAZY_LOADER = False+_LAZY_LOADER = False+if not os.environ.get('YTDLP_NO_LAZY_EXTRACTORS'):+ try:+ from .lazy_extractors import *+ from .lazy_extractors import _ALL_CLASSES+ _LAZY_LOADER = True+ except ImportError:+ passif not _LAZY_LOADER:from .extractors import *@@ -19,8 +20,8 @@ if not _LAZY_LOADER:]_ALL_CLASSES.append(GenericIE)- _PLUGIN_CLASSES = load_plugins('extractor', 'IE', globals())- _ALL_CLASSES = list(_PLUGIN_CLASSES.values()) + _ALL_CLASSES+_PLUGIN_CLASSES = load_plugins('extractor', 'IE', globals())+_ALL_CLASSES = list(_PLUGIN_CLASSES.values()) + _ALL_CLASSESdef gen_extractor_classes():