From 2091f26bda7f751a0ae2f6faa96dcd18a849f147 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Fri, 19 Feb 2021 21:49:02 -0800 Subject: [PATCH] Fix media previews --- src/main.rs | 2 +- src/utils.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6ba2654..0853618 100644 --- a/src/main.rs +++ b/src/main.rs @@ -186,7 +186,7 @@ async fn main() -> tide::Result<()> { .get(|req| handler(req, "https://emoji.redditmedia.com/{}/{}", vec!["id", "name"])); app .at("/preview/:loc/:id/:query/") - .get(|req| handler(req, "https://{}preview.redd.it/{}?{}", vec!["loc", "id", "query"])); + .get(|req| handler(req, "https://{}view.redd.it/{}?{}", vec!["loc", "id", "query"])); app .at("/style/*path/") /* */ .get(|req| handler(req, "https://styles.redditmedia.com/{}", vec!["path"])); diff --git a/src/utils.rs b/src/utils.rs index 8b58b34..12f0c1a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -208,8 +208,8 @@ pub fn format_url(url: &str) -> String { "a.thumbs.redditmedia.com" => capture(r"https://a\.thumbs\.redditmedia\.com/(.*)", "/thumb/a/", 1), "b.thumbs.redditmedia.com" => capture(r"https://b\.thumbs\.redditmedia\.com/(.*)", "/thumb/b/", 1), "emoji.redditmedia.com" => capture(r"https://emoji\.redditmedia\.com/(.*)/(.*)", "/emoji/", 2), - "preview.redd.it" => capture(r"https://preview\.redd\.it/(.*)\?(.*)", "/preview//", 2), - "external-preview.redd.it" => capture(r"https://external\-preview\.redd\.it/(.*)\?(.*)", "/preview/external-/", 2), + "preview.redd.it" => capture(r"https://preview\.redd\.it/(.*)\?(.*)", "/preview/pre/", 2), + "external-preview.redd.it" => capture(r"https://external\-preview\.redd\.it/(.*)\?(.*)", "/preview/external-pre/", 2), "styles.redditmedia.com" => capture(r"https://styles\.redditmedia\.com/(.*)", "/style/", 1), "www.redditstatic.com" => capture(r"https://www\.redditstatic\.com/(.*)", "/static/", 1), _ => String::new(),