My Actor 32
Pay $1.00 for 1,000 results
This Actor may be unreliable while under maintenance. Would you like to try a similar Actor instead?
See alternative ActorsMy Actor 32
Pay $1.00 for 1,000 results
You can access the My Actor 32 programmatically from your own Python 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.
1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "runMode": "DEVELOPMENT",
10 "startUrls": [{ "url": "https://apify.com" }],
11 "globs": [],
12 "linkSelector": "a[href]",
13 "pseudoUrls": [{ "purl": "https://apify.com[(/[\\w-]+)?]" }],
14 "pageFunction": """// The function accepts a single argument: the \"context\" object.
15// For a complete list of its properties and functions,
16// see https://apify.com/apify/web-scraper#page-function
17async function pageFunction(context) {
18 // This statement works as a breakpoint when you're trying to debug your code. Works only with Run mode: DEVELOPMENT!
19 // debugger;
20
21 // jQuery is handy for finding DOM elements and extracting data from them.
22 // To use it, make sure to enable the \"Inject jQuery\" option.
23 const $ = context.jQuery;
24 const pageTitle = $('title').first().text();
25
26 // Print some information to actor log
27 context.log.info(`URL: ${context.request.url}, TITLE: ${pageTitle}`);
28
29 // Manually add a new page to the queue for scraping.
30 await context.enqueueRequest({ url: 'http://www.example.com' });
31
32 // Return an object with the data extracted from the page.
33 // It will be stored to the resulting dataset.
34 return {
35 url: context.request.url,
36 pageTitle
37 };
38}""",
39 "proxyConfiguration": { "useApifyProxy": True },
40 "initialCookies": [],
41 "waitUntil": ["networkidle2"],
42 "preNavigationHooks": """// We need to return array of (possibly async) functions here.
43// The functions accept two arguments: the \"crawlingContext\" object
44// and \"gotoOptions\".
45[
46 async (crawlingContext, gotoOptions) => {
47 // ...
48 },
49]
50""",
51 "postNavigationHooks": """// We need to return array of (possibly async) functions here.
52// The functions accept a single argument: the \"crawlingContext\" object.
53[
54 async (crawlingContext) => {
55 // ...
56 },
57]""",
58 "breakpointLocation": "NONE",
59 "customData": {},
60}
61
62# Run the Actor and wait for it to finish
63run = client.actor("honzakirchner43/my-actor-32").call(run_input=run_input)
64
65# Fetch and print Actor results from the run's dataset (if there are any)
66print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
67for item in client.dataset(run["defaultDatasetId"]).iterate_items():
68 print(item)
69
70# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
My Actor 32 API in Python
The Apify API client for Python is the official library that allows you to use My Actor 32 API in Python, providing convenience functions and automatic retries on errors.
Install the apify-client
pip install apify-client
Other API clients include:
Actor Metrics
1 monthly user
-
1 star
59% runs succeeded
Created in May 2024
Modified 12 days ago