
Scrapy Executor
Deprecated
Pricing
Pay per usage
Go to Store

Scrapy Executor
Deprecated
Run Scrapy spiders written in Python on the Apify platform.
0.0 (0)
Pricing
Pay per usage
1
Total users
190
Monthly users
2
Runs succeeded
>99%
Last modified
2 years ago
You can access the Scrapy Executor programmatically from your own applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1import { ApifyClient } from 'apify-client';2
3// Initialize the ApifyClient with your Apify API token4// Replace the '<YOUR_API_TOKEN>' with your token5const client = new ApifyClient({6 token: '<YOUR_API_TOKEN>',7});8
9// Prepare Actor input10const input = {11 "scrapyCode": `import scrapy12 import apify13 14 class MySpider(scrapy.Spider):15 name = 'apifySpider'16 17 def start_requests(self):18 urls = [19 'https://apify.com',20 'https://apify.com/store',21 ]22 for url in urls:23 yield scrapy.Request(url=url, callback=self.parse)24 25 def parse(self, response):26 url = response.url27 title = response.css('title::text').get()28 output = {29 'url': url,30 'title': title31 }32 apify.pushData(output)`33};34
35// Run the Actor and wait for it to finish36const run = await client.actor("apify/scrapy-executor").call(input);37
38// Fetch and print Actor results from the run's dataset (if any)39console.log('Results from dataset');40console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);41const { items } = await client.dataset(run.defaultDatasetId).listItems();42items.forEach((item) => {43 console.dir(item);44});45
46// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Scrapy Executor API in JavaScript
The Apify API client for JavaScript is the official library that allows you to use Scrapy Executor API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.
Install the apify-client
$npm install apify-client
Other API clients include: