Tiktok Profile Scraper avatar

Tiktok Profile Scraper

Try for free

Pay $5.00 for 1,000 videos

View all Actors
Tiktok Profile Scraper

Tiktok Profile Scraper

clockworks/tiktok-profile-scraper
Try for free

Pay $5.00 for 1,000 videos

Extract data from TikTok profiles and videos they post. Get TikTok profile data, URLs, numbers of shares, followers, comments, hearts, video and music metadata. Export scraped data, run the scraper via API, schedule and monitor runs or integrate with other tools.

Do you want to learn more about this Actor?

Get a demo
IA

Getting ApifyApiError: Insufficient permissions for the Actor.

Closed

it-admin opened this issue
a month ago

I have been using the Instagram Scraper just fine, but when I try to create a run with this Actor, I get an error about not having permissions:

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/0FXVyOXXEmdGcV88a/runs stack: at makeRequest (/Users/jonk/celebrate2/node_modules/apify-client/src/http_client.ts:176:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at ActorClient.start (/Users/jonk/celebrate2/node_modules/apify-client/src/resource_clients/actor.ts:104:26) at startTikTokScraper (/Users/jonk/celebrate2/lib/apify.ts:89:15) at main (/Users/jonk/celebrate2/scripts/apify-test.ts:21:7) data: undefined { clientMethod: 'ActorClient.start', statusCode: 403, type: 'insufficient-permissions', attempt: 1, httpMethod: 'post', path: '/v2/acts/0FXVyOXXEmdGcV88a/runs', originalStack: '\n' + ' at makeRequest (/Users/jonk/celebrate2/node_modules/apify-client/src/http_client.ts:176:30)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + ' at ActorClient.start (/Users/jonk/celebrate2/node_modules/apify-client/src/resource_clients/actor.ts:104:26)\n' + ' at startTikTokScraper (/Users/jonk/celebrate2/lib/apify.ts:89:1... [trimmed]

lukas.prusa avatar

Hi, thanks for opening this issue!

Can you please share your code? 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?

Thanks!

IA

it-admin

a month ago

Here is a function I am using that works (for another actor):

1export async function startInstagramScraper(input: InstagramScraperInput) {
2  const run = await client.actor("shu8hvrXbJbY3Eb9W").start(input)
3  return run
4}

and here is the function I am using for the TikTok scraper, which doesn't work:

1export async function startTikTokScraper(input: TikTokScraperInput) {
2  const run = await client.actor("0FXVyOXXEmdGcV88a").start(input)
3  return run
4}

And for reference, here is the shape of my input to the TikTok scraper:

1type TikTokScraperInput = {
2  profiles: string[] // e.g. [""cost_n_mayor"]
3  resultsPerPage?: number // e.g. 30
4  oldestPostDate?: string // e.g. "2024-05-01"
5}

The only thing different is the input and the ID of the Actor I am calling.

I assume the API token is fine, since it works for the Instagram actor.

Any ideas?

lukas.prusa avatar

Your token is 99% to blame. Are you sure you are passing it in? When I test the client without any token, I get the same 403 error.

Can you share the whole code with, especially how you create the client variable as well, please? Obviously, censor the token ;)

JC

jonk-celebrate

a month ago

Gah sure enough.

Here are my imports:

// these imports must be at the top of the file import { neonConfig } from "@neondatabase/serverless" import "dotenv/config" import ws from "ws" neonConfig.webSocketConstructor = ws

// these imports must be after the other imports import { startTikTokScraper } from "@/lib/apify"

That last import had gotten sorted above the "dotenv/config" import, so the environment variable wasn't loaded when the library was loaded.

So dumb....

Thank you for the help

lukas.prusa avatar

Hmm, weird, it still shouldn't fail unless the startTikTokScraper function is called before the "dotenv/config" import.

But whatever, if it works, it works :D Happy scraping!

Developer
Maintained by Apify
Actor metrics
  • 501 monthly users
  • 294 stars
  • 99.8% runs succeeded
  • 2.1 days response time
  • Created in Mar 2023
  • Modified 2 days ago