Skip to content

Commit

Permalink
fix thisweekinreact extractor function
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosqsilva committed Oct 13, 2024
1 parent 661f946 commit 70ffc0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
run: pnpm install

- name: Update database
timeout-minutes: 2
working-directory: ./scraper
run: pnpm run update

Expand Down
Binary file modified scraper/database.db
Binary file not shown.
3 changes: 3 additions & 0 deletions scraper/newsletter/thisweekinreact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { extractContentDate } from "./javascripweekly/helper.ts";

const baseUrl = "https://thisweekinreact.com";

const issueUrlPattern = /newsletter\/\d+$/i;

export async function extractThisWeekInReact(browser: Browser, db: Storage) {
const page = browser.newPage();

Expand All @@ -22,6 +24,7 @@ export async function extractThisWeekInReact(browser: Browser, db: Storage) {
const url = issue?.querySelector("a")?.href;

if (!url) throw new Error("failed to extract url");
if (!issueUrlPattern.test(url)) continue;
if (db.isSaved(url)) continue;
if (url.endsWith("previous")) continue;

Expand Down

0 comments on commit 70ffc0e

Please sign in to comment.