fix: set headers to try and get through Letterboxd's CF bot detection
This will likely end up being a game of whack-a-mole in the long run but setting these headers seems to be sufficient to avoid getting a JS challenge for now.
···2727 url: String,
2828}
29293030+// CloudFlare's bot detection seems to be more generous towards user agents that don't include
3131+// known HTTP clients, like reqwest or curl.
3232+const USER_AGENT: &str = "myivo/1.0.0";
3333+3034pub async fn fetch() -> anyhow::Result<Media> {
3131- let client = Client::new();
3535+ let client = Client::builder()
3636+ .user_agent(USER_AGENT)
3737+ .build()
3838+ .context("failed to build client")?;
3239 let page_url = Url::parse("https://letterboxd.com/ivom/films/diary/")
3340 .context("wrote invalid Letterboxd URL")?;
3441 let html = client
3542 .get(page_url.clone())
4343+ // including this header seems to contribute to getting past CloudFlare's bot detection.
4444+ .header("priority", "u=0, i")
3645 .send()
3746 .await
3847 .context("failed to fetch Letterboxd page")?