Hardeepex / scraper

0 stars 0 forks source link

Sweep: can you find the css selectors and xpaths for scraping the content from these pages #4

Open Hardeepex opened 8 months ago

Hardeepex commented 8 months ago
Checklist - [X] Create `src/config.json` ✓ https://github.com/Hardeepex/scraper/commit/7d7bb882d9a5fd189c7c1a6d901a30bcddfe1281 [Edit](https://github.com/Hardeepex/scraper/edit/sweep/can_you_find_the_css_selectors_and_xpath/src/config.json) - [X] Running GitHub Actions for `src/config.json` ✓ [Edit](https://github.com/Hardeepex/scraper/edit/sweep/can_you_find_the_css_selectors_and_xpath/src/config.json) - [X] Modify `src/index.ts` ✓ https://github.com/Hardeepex/scraper/commit/e3654ac9f79c67322a3f663ee1939ed23a00c0bd [Edit](https://github.com/Hardeepex/scraper/edit/sweep/can_you_find_the_css_selectors_and_xpath/src/index.ts#L22-L34) - [X] Running GitHub Actions for `src/index.ts` ✓ [Edit](https://github.com/Hardeepex/scraper/edit/sweep/can_you_find_the_css_selectors_and_xpath/src/index.ts#L22-L34)
sweep-ai[bot] commented 8 months ago

🚀 Here's the PR! #5

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: 5e5a8f97a6)
Install Sweep Configs: Pull Request

[!TIP] I'll email you at hardeep.ex@gmail.com when I complete this pull request!


Actions (click)

Sandbox Execution ✓

Here are the sandbox execution logs prior to making any changes:

Sandbox logs for 13765ef
Checking src/index.ts for syntax errors... ✅ src/index.ts has no syntax errors! 1/1 ✓
Checking src/index.ts for syntax errors...
✅ src/index.ts has no syntax errors!

Sandbox passed on the latest main, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/Hardeepex/scraper/blob/13765ef8e3afc0dab3e124238b4871b25de7312f/src/index.ts#L1-L37 https://github.com/Hardeepex/scraper/blob/13765ef8e3afc0dab3e124238b4871b25de7312f/src/test.txt#L1-L-1

Step 2: ⌨️ Coding

Ran GitHub Actions for 7d7bb882d9a5fd189c7c1a6d901a30bcddfe1281:

--- 
+++ 
@@ -1,3 +1,4 @@
+import config from "./config.json";
 import axios from "axios";
 import cheerio from "cheerio";
 import { createObjectCsvWriter } from "csv-writer"
@@ -28,9 +29,9 @@
     const rankings: productData[] = [];

     rankingsTableRows.each((i, elem) => {
-      const name: string = $(elem).find(".product-name").text().trim();
-      const price: string = $(elem).find(".product-price").text().trim();
-      const description: string = $(elem).find(".product-description").text().trim();
+      const name: string = $(elem).find(config.selectors.name).text().trim();
+      const price: string = $(elem).find(config.selectors.price).text().trim();
+      const description: string = $(elem).find(config.selectors.description).text().trim();
       rankings.push({ name, price, description });
     });
     csvWriter.writeRecords(rankings).then(() => console.log("Written to file"))

Ran GitHub Actions for e3654ac9f79c67322a3f663ee1939ed23a00c0bd:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/can_you_find_the_css_selectors_and_xpath.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord