Tripadvisor Scraper
Pay $3.00 for 1,000 results
Tripadvisor Scraper
Pay $3.00 for 1,000 results
This unofficial Tripadvisor API is a data extraction tool able to get data on hotels, restaurants, things to do, vacation rentals, attractions, tours, and public trips. Get pricing, contact details, amenities, awards, ratings, and more. Download your data in Excel, JSON, CSV, and other formats.
Do you want to learn more about this Actor?
Get a demoI get error executing this actor via api: ApifyApiError: Insufficient permissions for the Actor. Make sure you're passing a correct API token and that it has the required permissions. clientMethod: ActorClient.start statusCode: 403 type: insufficient-permissions attempt: 1 httpMethod: post path: /v2/acts/maxcopell~tripadvisor/runs
Hi, thanks for opening this issue!
Can you share the code for your integration? This looks like an issue with the token... Are you using the correct Personal API token from the https://console.apify.com/settings/integrations tab? The 403
error is often thrown if you've just forgot to include the token.
Thanks!
import { ApifyClient } from 'apify-client'; import fs from 'fs'; import path from 'path'; import XLSX from 'xlsx';
// Initialize the ApifyClient with your Apify API token const client = new ApifyClient({ token: process.env.APIFY_API_TOKEN, });
// Prepare Actor input const input = { "locationFullName": "São Paulo", "maxItemsPerQuery": 15, "includeTags": true, "includeNearbyResults": false, "includeAttractions": true, "includeRestaurants": true, "includeHotels": true, "includeVacationRentals": false, "checkInDate": "", "checkOutDate": "", "includePriceOffers": false, "includeAiReviewsSummary": false, "language": "pt", "currency": "BRL" };
// Run the Actor and wait for it to finish try { const run = await client.actor("maxcopell/tripadvisor").call(input);
1// Fetch Actor results from the run's dataset (if any) 2console.log('Results from dataset'); 3console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`); 4const { items } = await client.dataset(run.defaultDatasetId).listItems(); 5items.forEach((item) => { 6 const timestamp = new Date().toISOString().replace(/[-:]/g, '').replace('T', '_').split('.')[0]; 7 const jsonFileName = `export/json/${item.id}_${timestamp}.json`; 8 const excelFileName = `export/excel/${item.id}_${timestamp}.xlsx`; 9 10 // Create directories if they do not exist 11 if (!fs.existsSync('expo... [trimmed]
Thanks for providing the code! It looks good, but the process.env.APIFY_API_TOKEN
value could still be undefined
, which would cause the 403 error.
Could you try attaching this at the start of the file?
1if (!process.env.APIFY_API_TOKEN) { 2 throw new Error('process.env.APIFY_API_TOKEN is not defined'); 3}
This will fail the code if the, if the variable is undefined. Let me know the outcome :)
You nailed it.
I haven't initialized the .env
Thanks!!
Actor Metrics
315 monthly users
-
78 stars
97% runs succeeded
6.2 days response time
Created in Nov 2019
Modified 18 days ago