Skip to content

Commit

Permalink
Default to hardcoded revision for list of pasta to prevent issues of …
Browse files Browse the repository at this point in the history
…the page changing and breaking html selectors
  • Loading branch information
Jonfor committed Dec 21, 2024
1 parent 09104be commit 43c78c1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pasta.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { parse } from "node-html-parser";

export async function fetchPastas() {
/**
*
* @param revision Defaults to revision on 23 November 2024
*/
export async function fetchPastas(revision = 1259032650) {
const response = await fetch(
"https://en.wikipedia.org/api/rest_v1/page/html/List_of_pasta?redirect=true",
`https://en.wikipedia.org/api/rest_v1/page/html/List_of_pasta/${revision}?redirect=true`,
);
const text = await response.text();
const root = parse(text);
Expand Down

0 comments on commit 43c78c1

Please sign in to comment.