SDK Version: 1.8.4
Last Updated: 2025-01-21
Thordata Web Scraper Tasks API provides pre-built scraping tools for 120+ platforms (Amazon, Google Maps, YouTube, TikTok, etc.). Tasks are created asynchronously and results are downloaded when ready.
- Task Builder Endpoint:
https://builderapi.thordata.com/web_scraper_api/create_task - Video Builder Endpoint:
https://builderapi.thordata.com/video_builder_api/create_task - Status Endpoint:
https://publicapi.thordata.com/api/web_scraper_api/get_task_status - Download Endpoint:
https://publicapi.thordata.com/api/web_scraper_api/get_task_result - Authentication:
scraper_token(for task creation),public_token+public_key(for status/result)
from thordata import ThordataClient
from thordata.tools import Amazon, GoogleMaps, YouTube
client = ThordataClient(
scraper_token="your_scraper_token",
public_token="your_public_token",
public_key="your_public_key"
)
# Create a task using a pre-built tool
task_id = client.run_tool(
Amazon.ProductByAsin(asin="B0BZYCJK89")
)
# Wait for completion
status = client.wait_for_task(task_id, max_wait=300)
# Get results
if status == "ready":
download_url = client.get_task_result(task_id)
print(f"Download: {download_url}")from thordata import ThordataClient, ScraperTaskConfig
client = ThordataClient(
scraper_token="your_scraper_token",
public_token="your_public_token",
public_key="your_public_key"
)
# Create task configuration
config = ScraperTaskConfig(
file_name="my_scrape_task",
spider_id="amazon_product_by-url",
spider_name="amazon.com",
parameters=[{"url": "https://www.amazon.com/dp/B000000000"}],
include_errors=True
)
# Create task
task_id = client.create_scraper_task_advanced(config)
# Wait and get results
status = client.wait_for_task(task_id, max_wait=600)
if status == "ready":
download_url = client.get_task_result(task_id)- Amazon: Product by ASIN, URL, Keywords, Category, Best Sellers, Reviews, Sellers
- eBay: Product by URL, Category URL, Keywords, List URL
- Walmart: Product by URL, Category URL, SKU, Keywords, Zipcodes
- TikTok: Post, Profile, Posts by Keywords/Profile/List, Shop, Profiles by List
- Instagram: Profile, Post, Profile by URL, Post by URL, All Reel, Reel by List
- Facebook: Post Details, Event by List/Search/Events, Profile, Comment
- Twitter/X: Profile, Post, Profile by Username, Post by Profile URL
- Reddit: Posts, Comment, Posts by Keywords/Subreddit
- LinkedIn: Company, Job by URL/Keyword
- Google Maps: Details by URL, CID, Location, Place ID
- Google Shopping: Product by URL, Keywords
- Google Play: App Info, Reviews
- YouTube: Video Download, Audio Download, Subtitle Download, Video Info, Profile by URL, Video Post by URL/Search/Hashtag/Keyword/Explore
- GitHub: Repository by URL, Repository by Search URL
- Indeed: Job by URL/Keyword, Company by URL/Keyword/Industry/List
- Glassdoor: Company by URL/Keywords/List/Input Filter, Job by URL/Keywords/List
- Crunchbase: Company by URL/Keywords
- Booking: Hotel by URL
- Zillow: Price by URL, Product by URL/Filter/List URL
- Airbnb: Product by Search URL/Location/URL
For a complete, up-to-date list of tools and spider IDs, you can:
- Call
client.list_tools()/async_client.list_tools()in the SDK to inspect the current registry. - Or consult the Web Scraper section of the official online documentation.
# Using pre-built tool (recommended)
task_id = client.run_tool(Amazon.ProductByAsin(asin="B0BZYCJK89"))
# Or manually
task_id = client.create_scraper_task(
file_name="task_name",
spider_id="amazon_product_by-asin",
spider_name="amazon.com",
parameters=[{"asin": "B0BZYCJK89"}]
)# Get current status
status = client.get_task_status(task_id)
print(f"Status: {status}")
# Wait for completion (with polling)
status = client.wait_for_task(
task_id,
poll_interval=5.0, # Check every 5 seconds
max_wait=600.0 # Maximum 10 minutes
)# Get download URL
download_url = client.get_task_result(task_id, file_type="json")
# Download and parse
import requests
response = requests.get(download_url)
data = response.json()ready: Task completed successfullysuccess: Task completed successfully (alias)finished: Task completed successfully (alias)failed: Task failederror: Task encountered an errorcancelled: Task was cancelledrunning: Task is currently executingpending: Task is queued
Video tasks require CommonSettings for download configuration:
from thordata import ThordataClient, CommonSettings
from thordata.tools import YouTube
client = ThordataClient(...)
settings = CommonSettings(
resolution="<=360p",
video_codec="vp9",
audio_format="opus",
bitrate="<=320",
selected_only=False
)
task_id = client.run_tool(
YouTube.VideoDownload(
url="https://www.youtube.com/watch?v=jNQXAC9IVRw",
common_settings=settings
)
)# Get task list
tasks = client.list_tasks(page=1, size=20)
print(f"Total tasks: {tasks['count']}")
for task in tasks['list']:
print(f"Task {task['task_id']}: {task['status']}")latest = client.get_latest_task_status()
print(f"Latest task: {latest.get('task_id')} - {latest.get('status')}")from thordata import (
ThordataClient,
ThordataError,
ThordataAuthError,
ThordataAPIError
)
client = ThordataClient(...)
try:
task_id = client.run_tool(Amazon.ProductByAsin(asin="B0BZYCJK89"))
status = client.wait_for_task(task_id, max_wait=300)
if status == "ready":
download_url = client.get_task_result(task_id)
else:
print(f"Task failed with status: {status}")
except ThordataAuthError as e:
print(f"Authentication error: {e}")
except ThordataAPIError as e:
print(f"API error: {e}")
except ThordataError as e:
print(f"SDK error: {e}")Results are returned as download URLs. Download the file to get JSON data:
{
"spider_parameter": {
"spider_id": "amazon_product_by-asin",
"spider_name": "amazon.com",
"parameters": [{"asin": "B0BZYCJK89"}]
},
"data": [
{
"title": "Product Title",
"price": "$99.99",
...
}
],
"metadata": {
"task_id": "xxx",
"created_at": "2025-01-01T00:00:00Z",
"status": "Ready"
}
}See Output Format Alignment for details.
- Use Pre-built Tools: Prefer
run_tool()with tool classes over manual task creation - Set Appropriate Timeouts: Use
max_waitbased on expected task duration - Poll Efficiently: Use
poll_intervalto balance responsiveness and API calls - Handle Errors: Always check task status before downloading results
- Batch Processing: Use
list_tasks()to monitor multiple tasks
| Feature | Web Scraper Tasks | Universal API | Browser API |
|---|---|---|---|
| Setup Complexity | Low (pre-built tools) | Medium | High (framework setup) |
| Platform Coverage | 120+ platforms | Any website | Any website |
| Execution Model | Async (task-based) | Sync/Async | Manual control |
| Use Case | Platform-specific scraping | General scraping | Complex automation |
Web Scraper Tasks API provides the easiest way to scrape popular platforms with pre-built tools. Use it when you need:
- Quick setup for supported platforms
- Platform-specific optimizations
- Batch processing of multiple tasks
- Asynchronous task execution
For unsupported platforms or custom requirements, use Universal API or Browser API.