Search & show listings
This commit is contained in:
@@ -4,9 +4,6 @@ let fetch = require('node-fetch');
|
||||
let cheerio = require('cheerio');
|
||||
let fs = require('fs');
|
||||
|
||||
|
||||
const pagesToTake = 10;
|
||||
|
||||
export default class OlxCrawler {
|
||||
|
||||
constructor(fromPage = 0, toPage = 10, maxResults = 1000) {
|
||||
@@ -69,6 +66,7 @@ export default class OlxCrawler {
|
||||
longDescription: descriptions.last().text(),
|
||||
lat,
|
||||
lng,
|
||||
loc: [parseFloat(lat), parseFloat(lng)],
|
||||
images
|
||||
};
|
||||
|
||||
@@ -85,10 +83,10 @@ export default class OlxCrawler {
|
||||
console.log('Starting to index page: ' + pageNr);
|
||||
const url = `http://www.olx.ba/pretraga?vrsta=samoizdavanje&sort_order=desc&kategorija=23&sort_po=datum&kanton=9&stranica=${pageNr}`;
|
||||
|
||||
const res = await fetch(url);
|
||||
const body = await res.text();
|
||||
const $ = cheerio.load(body);
|
||||
const hrefs = [];
|
||||
const res = await fetch(url);
|
||||
const body = await res.text();
|
||||
const $ = cheerio.load(body);
|
||||
const hrefs = [];
|
||||
const results = {};
|
||||
|
||||
$('#rezultatipretrage').find('.listitem').each((i, elem) => {
|
||||
@@ -135,5 +133,3 @@ export default class OlxCrawler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//indexSingle('http://www.olx.ba/artikal/23198642/trosoban-stan-centar-josipa-vancasa/');
|
||||
|
||||
Reference in New Issue
Block a user