another redgifs fix
This commit is contained in:
@@ -306,6 +306,12 @@ impl RedgifsProvider {
|
|||||||
|
|
||||||
let status = response.status().as_u16();
|
let status = response.status().as_u16();
|
||||||
let last_attempt = attempt + 1 == ATTEMPTS;
|
let last_attempt = attempt + 1 == ATTEMPTS;
|
||||||
|
crate::flow_debug!(
|
||||||
|
"trace=authed_get url={} attempt={} status={}",
|
||||||
|
crate::util::flow_debug::preview(url, 160),
|
||||||
|
attempt + 1,
|
||||||
|
status
|
||||||
|
);
|
||||||
if status == 401 && !last_attempt {
|
if status == 401 && !last_attempt {
|
||||||
force_refresh = true;
|
force_refresh = true;
|
||||||
continue;
|
continue;
|
||||||
@@ -343,7 +349,7 @@ impl RedgifsProvider {
|
|||||||
async fn fetch_tag(&self, tag: &str, sort: Sort, page: u16, per_page: usize, options: &ServerOptions) -> Result<Vec<Gif>> {
|
async fn fetch_tag(&self, tag: &str, sort: Sort, page: u16, per_page: usize, options: &ServerOptions) -> Result<Vec<Gif>> {
|
||||||
let encoded = utf8_percent_encode(tag, NON_ALPHANUMERIC).to_string();
|
let encoded = utf8_percent_encode(tag, NON_ALPHANUMERIC).to_string();
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{API_ROOT}/v2/gifs/search?tags={encoded}&order={}&page={page}&count={per_page}",
|
"{API_ROOT}/v2/gifs/search?type=g&tags={encoded}&order={}&page={page}&count={per_page}",
|
||||||
sort.search_order()
|
sort.search_order()
|
||||||
);
|
);
|
||||||
let text = self.authed_get(&url, options).await?;
|
let text = self.authed_get(&url, options).await?;
|
||||||
@@ -354,7 +360,7 @@ impl RedgifsProvider {
|
|||||||
async fn fetch_query(&self, text_query: &str, sort: Sort, page: u16, per_page: usize, options: &ServerOptions) -> Result<Vec<Gif>> {
|
async fn fetch_query(&self, text_query: &str, sort: Sort, page: u16, per_page: usize, options: &ServerOptions) -> Result<Vec<Gif>> {
|
||||||
let encoded = utf8_percent_encode(text_query, NON_ALPHANUMERIC).to_string();
|
let encoded = utf8_percent_encode(text_query, NON_ALPHANUMERIC).to_string();
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{API_ROOT}/v2/gifs/search?query={encoded}&order={}&page={page}&count={per_page}",
|
"{API_ROOT}/v2/gifs/search?type=g&query={encoded}&order={}&page={page}&count={per_page}",
|
||||||
sort.search_order()
|
sort.search_order()
|
||||||
);
|
);
|
||||||
let text = self.authed_get(&url, options).await?;
|
let text = self.authed_get(&url, options).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user