add rental scraper test script
This commit is contained in:
@@ -14,7 +14,8 @@
|
|||||||
"crawl": "cd app/crawler && node npmCrawl.js",
|
"crawl": "cd app/crawler && node npmCrawl.js",
|
||||||
"daily-notify": "cd app/npmScripts && node npmDailyNotify.js",
|
"daily-notify": "cd app/npmScripts && node npmDailyNotify.js",
|
||||||
"test-search": "cd test && node searchTest.js",
|
"test-search": "cd test && node searchTest.js",
|
||||||
"test-olx-scraper": "cd test && node olxScrapeTest.js"
|
"test-olx-scraper": "cd test && node olxScrapeTest.js",
|
||||||
|
"test-rental-scraper": "cd test && node rentalScrapeTest.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
17
test/rentalScrapeTest.js
Normal file
17
test/rentalScrapeTest.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const rentalCrawler = require("../app/crawler/specificCrawlers/rental");
|
||||||
|
|
||||||
|
const urlToScrape = process.argv[2] || undefined;
|
||||||
|
|
||||||
|
if (urlToScrape) {
|
||||||
|
const crawler = new rentalCrawler();
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const data = await crawler.scrapeAd(urlToScrape);
|
||||||
|
console.log(data);
|
||||||
|
})();
|
||||||
|
} else {
|
||||||
|
console.log("No URL to scrape. Use like this : ");
|
||||||
|
console.log("npm run test-olx-scraper -- URL_TO_SCRAPE");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user