trying to download all profile images from a userlist in a text file.

Hello, I found apify on the internet and through chatgpt I am trying to create a tiktok profile photo scraper but I can't find the solution... my current code takes a list of users from a text file and I would like it with the api The images will be downloaded to a particular directory but I am getting an error that I have not even been able to resolve with gpt chat. Can I publish my code here or should I do it another way? The console say : "We have bad news: there is no API endpoint at this URL. Did you specify it correctly?" but i don't know how to fix that :(
3 Replies
Hall
Hallโ€ข8mo ago
View post on community site
This post has been pushed to the community knowledgebase. Any replies in this thread will be synced to the community site.
Apify Community
conscious-sapphire
conscious-sapphireโ€ข8mo ago
hey, this code is quite clunky, the best approach would be to follow the example in the docs and edit it based on your use case: https://apify.com/clockworks/tiktok-profile-scraper/api/python
Apify
โ™ช Tiktok Profile Scraper API in Python ยท Apify
Learn how to interact with Tiktok Profile Scraper API in Python. Includes an example Python code snippet to help you get started quickly.
conscious-sapphire
conscious-sapphireโ€ข8mo ago
this can be a minimal example of how to print out profile images, you can add reading from/saving to files as needed, also you can specify more than one profile in the input
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
"profiles": ["apifyoffice"],
"resultsPerPage": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("clockworks/tiktok-profile-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("๐Ÿ’พ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item['authorMeta']['avatar'])

# ๐Ÿ“š Want to learn more ๐Ÿ“–? Go to โ†’ https://docs.apify.com/api/client/python/docs/quick-start
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
"profiles": ["apifyoffice"],
"resultsPerPage": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("clockworks/tiktok-profile-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("๐Ÿ’พ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item['authorMeta']['avatar'])

# ๐Ÿ“š Want to learn more ๐Ÿ“–? Go to โ†’ https://docs.apify.com/api/client/python/docs/quick-start

Did you find this page helpful?