From cd65c5e9bd9dfecd4570984bd2236dcd18ad6ac7 Mon Sep 17 00:00:00 2001 From: Lim Ding Wen Date: Thu, 25 Jul 2024 09:12:01 +0800 Subject: [PATCH] Add log messages to scrape bills introduced to better track scraping progress --- supabase/functions/scrape-bills-introduced/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/supabase/functions/scrape-bills-introduced/index.ts b/supabase/functions/scrape-bills-introduced/index.ts index cd924f9..6b06d35 100644 --- a/supabase/functions/scrape-bills-introduced/index.ts +++ b/supabase/functions/scrape-bills-introduced/index.ts @@ -25,6 +25,7 @@ Deno.serve(async (req) => { return buildResponse({ message: "Unauthorised." }, 401); } + console.log("Getting bills introduced HTML from URL..."); const billsIntroducedUrl = "https://www.parliament.gov.sg/parliamentary-business/bills-introduced"; const billsIntroducedPaginationSize = "40"; @@ -33,6 +34,7 @@ Deno.serve(async (req) => { body: new URLSearchParams({ PageSize: billsIntroducedPaginationSize }), }); + console.log("Parsing the downloaded HTML..."); const billsIntroducedHtml = await billsIntroducedResponse.text(); const billsIntroducedDoc = new DOMParser().parseFromString( billsIntroducedHtml, @@ -42,6 +44,7 @@ Deno.serve(async (req) => { let addCount = 0; let updateCount = 0; + console.log("Scraping and uploading relevant data..."); const billsIntroduced = billsIntroducedDoc.querySelectorAll( ".indv-bill", ) as Iterable;