Empty Python Actor
An Actor with the Apify SDK set up, so you can build any tool you need.
my_actor/main.py
my_actor/__main__.py
1"""Module defines the main entry point for the Apify Actor.2
3Feel free to modify this file to suit your specific needs.4
5To build Apify Actors, utilize the Apify SDK toolkit, read more at the official documentation:6https://docs.apify.com/sdk/python7"""8
9from __future__ import annotations10
11from apify import Actor12
13
14async def main() -> None:15 """Define a main entry point for the Apify Actor.16
17 This coroutine is executed using `asyncio.run()`, so it must remain an asynchronous function for proper execution.18 Asynchronous execution is required for communication with Apify platform, and it also enhances performance in19 the field of web scraping significantly.20 """21 async with Actor:22 Actor.log.info('Hello from the Actor!')23 # Write your code hereStart a new web scraping project quickly and easily in Python with our empty project template. It provides a basic structure for the Actor with Apify SDK and allows you to easily add your own functionality.
- Apify SDK for Python - a toolkit for building Apify Actors and scrapers in Python
- Input schema - define and easily validate a schema for your Actor's input
- Request queue - queues into which you can put the URLs you want to scrape
- Dataset - store structured data where each object stored has the same attributes
Insert your own code to async with Actor: block. You can use the Apify SDK with any other Python library.
- Python tutorials in Academy
- Video guide on getting data using Apify API
- Integration with Make, GitHub, Zapier, Google Drive, and other apps
- A short guide on how to build web scrapers using code templates:
BeautifulSoup crawler
Get data from every page on a site. Good for simple sites like blogs, news, or product listings, but it can't run client-side JavaScript. Uses BeautifulSoup, Python's most popular HTML parser.
Python one-page scraper
Get data from one web page with BeautifulSoup. The simplest way to start scraping.
Python project managed by uv
A general-purpose Python Actor with its project and dependencies managed by the uv package manager. A minimal starting point for any use case.
Python multi-page scraper
Get data from multiple web pages with BeautifulSoup. Fast and light for simple sites.
Python Playwright scraper
A real-browser scraper that gets data HTTP scrapers miss. Good for social feeds, dashboards, or single-page apps.
Python Selenium scraper
A Chrome browser scraper that renders JavaScript before extracting data. Good for social feeds, dashboards, or single-page apps.