Listings Monitor - News, blogs, issues, articles, products etc. avatar
Listings Monitor - News, blogs, issues, articles, products etc.
Try for free

No credit card required

View all Actors
Listings Monitor - News, blogs, issues, articles, products etc.

Listings Monitor - News, blogs, issues, articles, products etc.

cyberfly/listingmonitor
Try for free

No credit card required

Monitor content and listings on the web using optional keywords and filters. Take actions or receive alerts (e-mail, mobile push notifications etc.) on changes of interest. Use existing configs or easily create or request new ones. Useful for things like news, jobs, articles, products etc.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4client = ApifyClient("<YOUR_API_TOKEN>")
5
6# Prepare the Actor input
7run_input = {
8    "selectors": ["table table tr[class='athing'] td:nth-child(3) > span > a"],
9    "scrapers": """// (input) => ({\r
10//     title: {\r
11//         selectors: [\"table table tr[class='athing'] td:nth-child(3) > span > a\"],\r
12//         extractor: node => node.innerText,\r
13//     },\r
14//     links: {\r
15//         contents: {\r
16//             selectors: [\"table table tr[class='athing'] td:nth-child(3) > span > a\"],\r
17//             extractor: node => node.href,\r
18//         },\r
19//         comments: {\r
20//             selectors: [\"table table tr td[class='subtext'] span a[href^=item]:first-child\"],\r
21//             extractor: node => node.href,\r
22//         },\r
23//     },\r
24// })""",
25    "filters": """// [\r
26// \t({title}) => title.length > 1,\r
27// \t({links}) => links.contents.includes('http'),\r
28// \t({price}, {price: oldPrice}) => price < oldPrice,\r
29// ]""",
30    "matcher": """// E.g. exclude dynamic \"price\":\r
31// ({price, ...match}) => match""",
32    "pages.retries": 3,
33    "hooks.load": """// async page => {
34// \tawait page.click('button[name=\"cookie-consent\"]').catch(error => null);
35// }""",
36    "limits.alerts": 10,
37    "limits.results": 100,
38    "proxy": { "useApifyProxy": False },
39}
40
41# Run the Actor and wait for it to finish
42run = client.actor("cyberfly/listingmonitor").call(run_input=run_input)
43
44# Fetch and print Actor results from the run's dataset (if there are any)
45print("๐Ÿ’พ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
46for item in client.dataset(run["defaultDatasetId"]).iterate_items():
47    print(item)
48
49# ๐Ÿ“š Want to learn more ๐Ÿ“–? Go to โ†’ https://docs.apify.com/api/client/python/docs/quick-start
Developer
Maintained by Community
Actor metrics
  • 4 monthly users
  • 2 stars
  • 98.6% runs succeeded
  • Created in Jan 2024
  • Modified 9 days ago
Categories