Giter VIP home page Giter VIP logo

Comments (7)

mwpenny avatar mwpenny commented on August 22, 2024

@thierryskoda Can you provide the values you tried?

from kijiji-scraper.

thierryskoda avatar thierryskoda commented on August 22, 2024

@mwpenny I tried :

{
    "locationId": "ontario",
    "categoryId": "cars"
}

But I'm not sure where to get those info. In the tutorial it says :

You can find them by using your browser's developer tools and performing a custom search on Kijiji.

But I'm not really sure to understand this part.

Thank you !

from kijiji-scraper.

mwpenny avatar mwpenny commented on August 22, 2024

@thierryskoda locationId and categoryId are integers, not strings. Kijiji uses them internally when you select your location and category on the website. You can find the locationId/categoryId values you want by performing a search and looking at the POST request parameters or the URL you are redirected to.

For example, after setting my location to Ottawa and selecting the "cars & vehicles" category, Kijiji redirects me to http://www.kijiji.ca/b-cars-vehicles/ottawa/c27l1700185. The last part of the URL (c27l1700185) is formatted as c[categoryId]l[locationId]. So in this case, categoryId is 27 and locationId is 1700185.

Perform your custom search on Kijiji and then check the URL for the corresponding Id values.

from kijiji-scraper.

thierryskoda avatar thierryskoda commented on August 22, 2024

@mwpenny Oh thanks! I tried this and this still returning me empty array. Am I missing something else?

var kijiji = require("kijiji-scraper")

var prefs = {
    "locationId": 27,
    "categoryId": 1700185
}

var params = {
    "minPrice": 0,
    "maxPrice": 100000,
    "keywords": "toyota",
    "adType": "OFFER"
}

kijiji.query(prefs, params, function(err, ads) {
    //Use the ads array
    console.log(ads);
});

from kijiji-scraper.

mwpenny avatar mwpenny commented on August 22, 2024

@thierryskoda It looks like you have your locationId and categoryId values switched.

from kijiji-scraper.

thierryskoda avatar thierryskoda commented on August 22, 2024

@mwpenny Wow sorry for this mistake.. Now it works! Thank you very much!!!

from kijiji-scraper.

mwpenny avatar mwpenny commented on August 22, 2024

@thierryskoda Glad to help!

from kijiji-scraper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.