Hotfix for yt restricted search
This commit is contained in:
parent
b80f6559a7
commit
bf104362ea
2 changed files with 11 additions and 4 deletions
|
@ -32,7 +32,8 @@ import socketio
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from profanity_check import predict
|
from profanity_check import predict
|
||||||
|
|
||||||
from syng.result import Result
|
from .result import Result
|
||||||
|
from .sources.youtube import YouTube
|
||||||
|
|
||||||
from . import jsonencoder
|
from . import jsonencoder
|
||||||
from .entry import Entry
|
from .entry import Entry
|
||||||
|
@ -1125,6 +1126,12 @@ async def handle_search_results(sid: str, data: dict[str, Any]) -> None:
|
||||||
web_sid = data["sid"]
|
web_sid = data["sid"]
|
||||||
results = [Result.from_dict(result) for result in data["results"]]
|
results = [Result.from_dict(result) for result in data["results"]]
|
||||||
|
|
||||||
|
# TODO this handles YouTubes anti-bot measures
|
||||||
|
|
||||||
|
__unused_yt_list = [
|
||||||
|
YouTube.from_result(result) for result in data["results"] if "youtube" in "ident"
|
||||||
|
]
|
||||||
|
|
||||||
await send_search_results(web_sid, results)
|
await send_search_results(web_sid, results)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ class YouTube:
|
||||||
A minimal compatibility layer for the YouTube object of pytube, implemented via yt-dlp
|
A minimal compatibility layer for the YouTube object of pytube, implemented via yt-dlp
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__cache__: dict[str, Any] = (
|
__cache__: dict[
|
||||||
{}
|
str, Any
|
||||||
) # TODO: this may grow fast... but atm it fixed youtubes anti bot measures
|
] = {} # TODO: this may grow fast... but atm it fixed youtubes anti bot measures
|
||||||
|
|
||||||
def __init__(self, url: Optional[str] = None):
|
def __init__(self, url: Optional[str] = None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue