Olx scraper debugging.
This commit is contained in:
@@ -205,7 +205,7 @@ class OlxCrawler {
|
||||
}
|
||||
|
||||
async scrapeAd(url) {
|
||||
//console.log("Scraping : ", url);
|
||||
console.log("Scraping : ", url);
|
||||
try {
|
||||
const adPageSource = await fetch(url);
|
||||
const body = await adPageSource.text();
|
||||
@@ -249,6 +249,8 @@ class OlxCrawler {
|
||||
.text()
|
||||
.trim();
|
||||
//
|
||||
console.log("Title:", title);
|
||||
console.log("Url scraped:", url);
|
||||
console.log("Normal price value:", normalPriceValue);
|
||||
console.log("Urgent price value:", urgentPriceValue);
|
||||
//
|
||||
@@ -293,7 +295,7 @@ class OlxCrawler {
|
||||
|
||||
let otherInformationDivId;
|
||||
//We need to locate DIV ID where other information are stored
|
||||
for (let possibleId = 10; possibleId <= 20; possibleId++) {
|
||||
for (let possibleId = 1; possibleId <= 30; possibleId++) {
|
||||
const adTypeFieldTitle = $(
|
||||
`#artikal_glavni_div > div.artikal_lijevo > div:nth-child(${possibleId}) > div:nth-child(2) > div.df1`
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ if (urlToScrape) {
|
||||
|
||||
(async () => {
|
||||
const data = await crawler.scrapeAd(urlToScrape);
|
||||
console.log(data);
|
||||
console.log("Scraped data:", data);
|
||||
})();
|
||||
} else {
|
||||
console.log("No URL to scrape. Use like this : ");
|
||||
|
||||
Reference in New Issue
Block a user