mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-10-07 01:32:13 +00:00
fix(fetch): one status table — a persistent 4xx is permanent everywhere
status_error's catch-all called every unlisted status Transient, so a 400/405/418/451 got three retries per link before the same answer (twitter syndication's broken-token 400 being the live example), and download_status_error plus misskey's and bilibili's local fallbacks each carried their own copy of the table — bilibili and misskey classifying a 404 as Transient while the center classified it NotFound. The center now makes any client error except 408/429 a refusal (permanent), the media path delegates to it as status_error("media", ...) and its duplicated fn is deleted, and misskey/bilibili fall through to the center after their own special statuses (misskey's 400 body, bilibili's 412). A table test pins every class.
This commit is contained in:
@@ -213,10 +213,11 @@ pub async fn fetch(dynamic_id: &str) -> Result<model::Item, FetchError> {
|
||||
if !status.is_success() {
|
||||
return Err(match status.as_u16() {
|
||||
412 => risk_control("412"),
|
||||
// A refusal or an auth demand is not a bad moment (412 above is
|
||||
// bilibili's risk control, which does clear on its own).
|
||||
401 | 403 => FetchError::Blocked,
|
||||
_ => FetchError::Transient(format!("bilibili status {status}")),
|
||||
// Everything else shares the central classes (refusals and gone
|
||||
// posts permanent, 429/5xx retried). The local fallback used to
|
||||
// disagree: a bilibili 404 came back Transient here. 412 above is
|
||||
// bilibili's risk control, which does clear on its own.
|
||||
_ => crate::site::status_error("bilibili", status),
|
||||
});
|
||||
}
|
||||
let detail: model::Detail = response.json().await.map_err(|e| FetchError::Site {
|
||||
|
||||
Reference in New Issue
Block a user