Fix url rewrites
This commit is contained in:
parent
686d61801f
commit
be2a1d876b
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1512,9 +1512,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.62"
|
version = "1.0.63"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486"
|
checksum = "43535db9747a4ba938c0ce0a98cc631a46ebf943c9e1d604e091df6007620bf6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
@ -123,7 +123,7 @@ impl Media {
|
|||||||
(
|
(
|
||||||
post_type.to_string(),
|
post_type.to_string(),
|
||||||
Self {
|
Self {
|
||||||
url: url.as_str().unwrap_or_default().to_string(),
|
url: format_url(url.as_str().unwrap_or_default()).to_string(),
|
||||||
width: source["width"].as_i64().unwrap_or_default(),
|
width: source["width"].as_i64().unwrap_or_default(),
|
||||||
height: source["height"].as_i64().unwrap_or_default(),
|
height: source["height"].as_i64().unwrap_or_default(),
|
||||||
poster: format_url(source["url"].as_str().unwrap_or_default()),
|
poster: format_url(source["url"].as_str().unwrap_or_default()),
|
||||||
@ -222,6 +222,7 @@ impl Post {
|
|||||||
|
|
||||||
// Determine the type of media along with the media URL
|
// Determine the type of media along with the media URL
|
||||||
let (post_type, media, gallery) = Media::parse(&data).await;
|
let (post_type, media, gallery) = Media::parse(&data).await;
|
||||||
|
dbg!(&media.url);
|
||||||
|
|
||||||
posts.push(Self {
|
posts.push(Self {
|
||||||
id: val(post, "id"),
|
id: val(post, "id"),
|
||||||
@ -539,10 +540,12 @@ pub async fn request(path: String) -> Result<Value, String> {
|
|||||||
Err(
|
Err(
|
||||||
json["reason"]
|
json["reason"]
|
||||||
.as_str()
|
.as_str()
|
||||||
.unwrap_or(json["message"].as_str().unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
|
json["message"].as_str().unwrap_or_else(|| {
|
||||||
println!("{} - Error parsing reddit error", url);
|
println!("{} - Error parsing reddit error", url);
|
||||||
"Error parsing reddit error"
|
"Error parsing reddit error"
|
||||||
}))
|
})
|
||||||
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user