dimitryzub / hotels-scraper-js

Scrape Airbnb, Booking, Hotels.com from a single JavaScript module. ❗No longer maintained.
https://www.npmjs.com/package/hotels-scraper-js
MIT License
15 stars 1 forks source link

I can't scrap Hotels.com #5

Open juseoljae opened 10 months ago

juseoljae commented 10 months ago

first, I did below npm i hotels-scraper-js

then, GetHotelsCom.js is very simple import { hotelsCom, saveToJSON } from "hotels-scraper-js"; hotelsCom.getHotels().then(saveToJSON);

then, node GetHotelsCom.js

it occurs error D:\Web\hotelsScrap\hotels-scraper-js-main\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:258 throw new Error('Evaluation failed: ' + (0, util_js_1.getExceptionMessage)(exceptionDetails)); ^

Error: Evaluation failed: TypeError: Cannot read properties of null (reading 'textContent') at pptr://puppeteer_evaluation_script:7:38 at Array.map () at pptr://puppeteer_evaluation_script:2:121 at ExecutionContext._ExecutionContext_evaluate (D:\Web\hotelsScrap\hotels-scraper-js-main\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:258:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (D:\Web\hotelsScrap\hotels-scraper-js-main\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:146:16) at async getHotelsInfo (file:///D:/Web/hotelsScrap/hotels-scraper-js-main/node_modules/hotels-scraper-js/hotelsComParser/getHotelsComHotels.js:39:10) at async getHotelsComHotels (file:///D:/Web/hotelsScrap/hotels-scraper-js-main/node_modules/hotels-scraper-js/hotelsComParser/getHotelsComHotels.js:361:19)

Node.js v18.17.1

can you help me?

QuentinSc commented 7 months ago

The package need an update, same for airbnb :/

Sv-Shok commented 5 months ago

Could you tell me what exactly needs to be updated?

dimitryzub commented 5 months ago

Hey guys, this package is no longer being maintained.

Regarding the issue both with Hotels.com and Airbnb. Most likely it's due to CSS selector change.

In other words, CSS selector on the website doesn't match CSS selector in the parser and thus it can't get anything from the website Cannot read properties of null (reading 'textContent')

For Hotels, it's here:

If it's the case, you need to change CSS selectors in the parser.

Or it could be something else.