Skip to content

Commit

Permalink
Merge pull request #37 from freedit-dev/fix-Home-feed-stale
Browse files Browse the repository at this point in the history
fix home feed stale
  • Loading branch information
HookedBehemoth authored Jun 22, 2024
2 parents 4f468b6 + 201c260 commit 5d145da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/api/section.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use super::{common::Articles, error::ApiResult, fetch::fetch};

const API_URL: &str =
"https://www.reuters.com/pf/api/v3/content/fetch/articles-by-section-alias-or-id-v1";
"https://www.reuters.com/pf/api/v3/content/fetch/recent-stories-by-sections-v1";

pub fn fetch_articles_by_section(
client: &ureq::Agent,
path: &str,
offset: u32,
size: u32,
) -> ApiResult<Articles> {
let query =
format!(r#"{{"offset":{offset},"size":{size},"section_id":"{path}","website":"reuters"}}"#);
let query = format!(
r#"{{"offset":{offset},"size":{size},"section_ids":"{path}","website":"reuters"}}"#
);

fetch(client, API_URL, &query)
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn main() {
rouille::start_server(list_address, move |request| {
let path = request.url();
let response = match path.as_str() {
"/" | "/home" => render_section(&client, "/home", 0, 8),
"/" | "/world" => render_section(&client, "/world/", 0, 8),
"/about" => render_about(),
"/search" | "/search/" => render_search(&client, request),
"/main.css" => {
Expand Down

0 comments on commit 5d145da

Please sign in to comment.