mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-01-25 08:11:41 +00:00
[ie/youtube] Fix priorization of youtube URL matching (#15596)
Authored by: Grub4K
This commit is contained in:
@@ -1,32 +1,4 @@
|
|||||||
# flake8: noqa: F401
|
# flake8: noqa: F401
|
||||||
# isort: off
|
|
||||||
|
|
||||||
from .youtube import ( # Youtube is moved to the top to improve performance
|
|
||||||
YoutubeIE,
|
|
||||||
YoutubeClipIE,
|
|
||||||
YoutubeFavouritesIE,
|
|
||||||
YoutubeNotificationsIE,
|
|
||||||
YoutubeHistoryIE,
|
|
||||||
YoutubeTabIE,
|
|
||||||
YoutubeLivestreamEmbedIE,
|
|
||||||
YoutubePlaylistIE,
|
|
||||||
YoutubeRecommendedIE,
|
|
||||||
YoutubeSearchDateIE,
|
|
||||||
YoutubeSearchIE,
|
|
||||||
YoutubeSearchURLIE,
|
|
||||||
YoutubeMusicSearchURLIE,
|
|
||||||
YoutubeSubscriptionsIE,
|
|
||||||
YoutubeTruncatedIDIE,
|
|
||||||
YoutubeTruncatedURLIE,
|
|
||||||
YoutubeYtBeIE,
|
|
||||||
YoutubeYtUserIE,
|
|
||||||
YoutubeWatchLaterIE,
|
|
||||||
YoutubeShortsAudioPivotIE,
|
|
||||||
YoutubeConsentRedirectIE,
|
|
||||||
)
|
|
||||||
|
|
||||||
# isort: on
|
|
||||||
|
|
||||||
from .abc import (
|
from .abc import (
|
||||||
ABCIE,
|
ABCIE,
|
||||||
ABCIViewIE,
|
ABCIViewIE,
|
||||||
@@ -2551,6 +2523,29 @@ from .youporn import (
|
|||||||
YouPornTagIE,
|
YouPornTagIE,
|
||||||
YouPornVideosIE,
|
YouPornVideosIE,
|
||||||
)
|
)
|
||||||
|
from .youtube import (
|
||||||
|
YoutubeClipIE,
|
||||||
|
YoutubeConsentRedirectIE,
|
||||||
|
YoutubeFavouritesIE,
|
||||||
|
YoutubeHistoryIE,
|
||||||
|
YoutubeIE,
|
||||||
|
YoutubeLivestreamEmbedIE,
|
||||||
|
YoutubeMusicSearchURLIE,
|
||||||
|
YoutubeNotificationsIE,
|
||||||
|
YoutubePlaylistIE,
|
||||||
|
YoutubeRecommendedIE,
|
||||||
|
YoutubeSearchDateIE,
|
||||||
|
YoutubeSearchIE,
|
||||||
|
YoutubeSearchURLIE,
|
||||||
|
YoutubeShortsAudioPivotIE,
|
||||||
|
YoutubeSubscriptionsIE,
|
||||||
|
YoutubeTabIE,
|
||||||
|
YoutubeTruncatedIDIE,
|
||||||
|
YoutubeTruncatedURLIE,
|
||||||
|
YoutubeWatchLaterIE,
|
||||||
|
YoutubeYtBeIE,
|
||||||
|
YoutubeYtUserIE,
|
||||||
|
)
|
||||||
from .zaiko import (
|
from .zaiko import (
|
||||||
ZaikoETicketIE,
|
ZaikoETicketIE,
|
||||||
ZaikoIE,
|
ZaikoIE,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import inspect
|
import itertools
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from ..globals import LAZY_EXTRACTORS
|
from ..globals import LAZY_EXTRACTORS
|
||||||
@@ -17,12 +17,18 @@ else:
|
|||||||
if not _CLASS_LOOKUP:
|
if not _CLASS_LOOKUP:
|
||||||
from . import _extractors
|
from . import _extractors
|
||||||
|
|
||||||
_CLASS_LOOKUP = {
|
members = tuple(
|
||||||
name: value
|
(name, getattr(_extractors, name))
|
||||||
for name, value in inspect.getmembers(_extractors)
|
for name in dir(_extractors)
|
||||||
if name.endswith('IE') and name != 'GenericIE'
|
if name.endswith('IE')
|
||||||
}
|
)
|
||||||
_CLASS_LOOKUP['GenericIE'] = _extractors.GenericIE
|
_CLASS_LOOKUP = dict(itertools.chain(
|
||||||
|
# Add Youtube first to improve matching performance
|
||||||
|
((name, value) for name, value in members if '.youtube' in value.__module__),
|
||||||
|
# Add Generic last so that it is the fallback
|
||||||
|
((name, value) for name, value in members if name != 'GenericIE'),
|
||||||
|
(('GenericIE', _extractors.GenericIE),),
|
||||||
|
))
|
||||||
|
|
||||||
# We want to append to the main lookup
|
# We want to append to the main lookup
|
||||||
_current = _extractors_context.value
|
_current = _extractors_context.value
|
||||||
|
|||||||
Reference in New Issue
Block a user