rework: BOT_MESSAGES list, drop config toggle, always stop on bot detection

This commit is contained in:
Jordan May 2026-02-22 15:30:37 -05:00
parent f786a9c62e
commit 0cbabd7cad
No known key found for this signature in database
6 changed files with 12 additions and 31 deletions

View File

@ -59,7 +59,6 @@ class AppConfigDownloadsSerializer(
extractor_lang = serializers.CharField(allow_null=True)
integrate_ryd = serializers.BooleanField()
integrate_sponsorblock = serializers.BooleanField()
stop_on_bot = serializers.BooleanField()
class AppConfigAppSerializer(

View File

@ -46,7 +46,6 @@ class DownloadsConfigType(TypedDict):
extractor_lang: str | None
integrate_ryd: bool
integrate_sponsorblock: bool
stop_on_bot: bool
class ApplicationConfigType(TypedDict):
@ -96,7 +95,6 @@ class AppConfig:
"extractor_lang": None,
"integrate_ryd": False,
"integrate_sponsorblock": False,
"stop_on_bot": True,
},
"application": {
"enable_snapshot": True,

View File

@ -20,6 +20,10 @@ from django.conf import settings
class YtWrap:
"""wrap calls to yt"""
BOT_MESSAGES = [
"not a bot",
]
OBS_BASE = {
"default_search": "ytsearch",
"quiet": True,
@ -94,11 +98,10 @@ class YtWrap:
print(f"{url}: failed to download with message {err}")
if "Temporary failure in name resolution" in str(err):
raise ConnectionError("lost the internet, abort!") from err
if self.config["downloads"].get("stop_on_bot"):
if "not a bot" in str(err):
raise ConnectionError(
"YouTube bot detection, abort!"
) from err
if any(m in str(err) for m in self.BOT_MESSAGES):
raise ConnectionError(
"YouTube bot detection, abort!"
) from err
return False, str(err)
@ -127,11 +130,10 @@ class YtWrap:
print(f"{url}: failed to get info from youtube: {err}")
if "Temporary failure in name resolution" in str(err):
raise ConnectionError("lost the internet, abort!") from err
if self.config["downloads"].get("stop_on_bot"):
if "not a bot" in str(err):
raise ConnectionError(
"YouTube bot detection, abort!"
) from err
if any(m in str(err) for m in self.BOT_MESSAGES):
raise ConnectionError(
"YouTube bot detection, abort!"
) from err
return None, str(err)

View File

@ -27,7 +27,6 @@ export type AppSettingsConfigType = {
extractor_lang: string | null;
integrate_ryd: boolean;
integrate_sponsorblock: boolean;
stop_on_bot: boolean;
};
application: {
enable_snapshot: boolean;

View File

@ -50,7 +50,6 @@ const SettingsApplication = () => {
const [currentThrottledRate, setCurrentThrottledRate] = useState<number | null>(null);
const [currentScrapingSleep, setCurrentScrapingSleep] = useState<number | null>(null);
const [currentAutodelete, setCurrentAutodelete] = useState<number | null>(null);
const [stopOnBot, setStopOnBot] = useState(true);
// Download Format
const [downloadsFormat, setDownloadsFormat] = useState<string | null>(null);
@ -107,7 +106,6 @@ const SettingsApplication = () => {
setCurrentThrottledRate(appSettingsConfigData?.downloads.throttledratelimit || null);
setCurrentScrapingSleep(appSettingsConfigData?.downloads.sleep_interval || null);
setCurrentAutodelete(appSettingsConfigData?.downloads.autodelete_days || null);
setStopOnBot(appSettingsConfigData?.downloads.stop_on_bot ?? true);
// Download Format
setDownloadsFormat(appSettingsConfigData?.downloads.format || null);
@ -310,10 +308,6 @@ const SettingsApplication = () => {
<li>Minimal recommended is 10.</li>
</ul>
</li>
<li>
Stop on bot detection will stop the download queue when YT returns a bot
detection error instead of continuing to fail every remaining video.
</li>
<li>
Auto delete deletes videos marked as watched after x days.
<ul>
@ -363,16 +357,6 @@ const SettingsApplication = () => {
updateCallback={handleUpdateConfig}
/>
</div>
<div className="settings-box-wrapper">
<div>
<p>Stop queue on bot detection</p>
</div>
<ToggleConfig
name="downloads.stop_on_bot"
value={stopOnBot}
updateCallback={handleUpdateConfig}
/>
</div>
<div className="settings-box-wrapper">
<div>
<p>

View File

@ -34,7 +34,6 @@ export const useAppSettingsStore = create<AppSettingsState>(set => ({
extractor_lang: null,
integrate_ryd: false,
integrate_sponsorblock: false,
stop_on_bot: true,
},
application: {
enable_snapshot: false,