add OLX scraper test NPM script

This commit is contained in:
Bilal Catic
2019-10-18 09:14:08 +02:00
parent 2baf26db1c
commit 67a7223a3a
2 changed files with 19 additions and 1 deletions

17
test/olxScrapeTest.js Normal file
View File

@@ -0,0 +1,17 @@
"use strict";
const olxCrawler = require("../app/crawler/specific/olx");
const urlToScrape = process.argv[2] || undefined;
if (urlToScrape) {
const crawler = new olxCrawler();
(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");
}