polarcrawl 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
polarcrawl/__init__.py ADDED
@@ -0,0 +1,38 @@
1
+ """Run PolarCrawl's ready-made scrapers from Python and get clean rows back."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ from typing import Any
8
+ from urllib.request import Request, urlopen
9
+
10
+ from apify_client import ApifyClient
11
+
12
+ __all__ = ['list_actors', 'run']
13
+
14
+ CATALOG_URL = 'https://polarcrawl.com/actors.json'
15
+ TOKEN_HELP = 'Pass token= or set APIFY_TOKEN. Get a token at https://console.apify.com/settings/integrations'
16
+
17
+
18
+ def list_actors() -> list[dict[str, Any]]:
19
+ """Every PolarCrawl actor, with prices, inputs and output fields, read live from polarcrawl.com."""
20
+ # Cloudflare's browser check refuses urllib's default "Python-urllib" user agent.
21
+ with urlopen(Request(CATALOG_URL, headers={'User-Agent': 'polarcrawl-python'})) as res:
22
+ return json.load(res)['actors']
23
+
24
+
25
+ def run(actor_id: str, run_input: dict[str, Any], *, token: str | None = None, **options: Any) -> list[dict[str, Any]]:
26
+ """Run an actor, wait for it to finish and return its result rows.
27
+
28
+ actor_id is the id from list_actors(), e.g. "vero-api/jobs-scraper". Extra keyword arguments go to
29
+ Apify's ActorClient.call, e.g. max_total_charge_usd=Decimal('1') to cap what the run can spend.
30
+ """
31
+ token = token or os.environ.get('APIFY_TOKEN')
32
+ if not token:
33
+ raise ValueError(f'No Apify token. {TOKEN_HELP}')
34
+ client = ApifyClient(token)
35
+ finished = client.actor(actor_id).call(run_input=run_input, **{'logger': None, **options})
36
+ if finished is None:
37
+ raise RuntimeError(f'{actor_id} did not finish.')
38
+ return client.dataset(finished.default_dataset_id).list_items().items
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.5
2
+ Name: polarcrawl
3
+ Version: 0.1.0
4
+ Summary: Run PolarCrawl's ready-made scrapers (WhatsApp, Telegram, jobs, Instagram, Airbnb, ads) from Python and get clean rows back.
5
+ Project-URL: Homepage, https://polarcrawl.com
6
+ Project-URL: Actors, https://polarcrawl.com/actors
7
+ Author-email: PolarCrawl <hello@polarcrawl.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: airbnb,apify,data-api,instagram,jobs,scraper,telegram,web-scraping,whatsapp
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: apify-client>=3.6.0
13
+ Description-Content-Type: text/markdown
14
+
15
+ # polarcrawl
16
+
17
+ Run [PolarCrawl](https://polarcrawl.com)'s ready-made scrapers from Python and get clean rows back: WhatsApp, Telegram, jobs, Instagram, Airbnb, ads and more.
18
+
19
+ Every actor is pay per result: you pay a fixed price for each row through your Apify account, never for servers. Apify's free plan includes monthly credit.
20
+
21
+ ## Install
22
+
23
+ ```sh
24
+ pip install polarcrawl
25
+ ```
26
+
27
+ You need an Apify API token. Get one at [console.apify.com/settings/integrations](https://console.apify.com/settings/integrations) and set it as `APIFY_TOKEN`, or pass `token=`.
28
+
29
+ ## Run an actor
30
+
31
+ ```python
32
+ from polarcrawl import run
33
+
34
+ jobs = run('vero-api/jobs-scraper', {
35
+ 'searchTerm': 'data engineer',
36
+ 'country': 'us',
37
+ 'location': 'New York, NY',
38
+ 'maxResults': 50,
39
+ })
40
+
41
+ print(len(jobs), jobs[0])
42
+ ```
43
+
44
+ `run` waits for the actor to finish and returns its rows. It also takes Apify's run options, for example a spending cap:
45
+
46
+ ```python
47
+ from decimal import Decimal
48
+
49
+ run('vero-api/whatsapp-scraper', {'numbers': ['+1 415 555 0178']}, max_total_charge_usd=Decimal('1'))
50
+ ```
51
+
52
+ ## List the actors
53
+
54
+ ```python
55
+ from polarcrawl import list_actors
56
+
57
+ for actor in list_actors():
58
+ print(actor['id'], actor['price']['perThousandUsd']['free'], actor['tagline'])
59
+ ```
60
+
61
+ Each actor comes with its price, input fields, an example input and its output fields, read live from [polarcrawl.com/actors.json](https://polarcrawl.com/actors.json).
62
+
63
+ ## For AI agents
64
+
65
+ Connect every actor to Claude, ChatGPT, Grok Build/Cursor or VS Code through the Apify MCP server: [polarcrawl.com/mcp](https://polarcrawl.com/mcp).
66
+
67
+ ## Links
68
+
69
+ - All actors: [polarcrawl.com/actors](https://polarcrawl.com/actors)
70
+ - Pricing: [polarcrawl.com/pricing](https://polarcrawl.com/pricing)
71
+ - Contact: [hello@polarcrawl.com](mailto:hello@polarcrawl.com)
@@ -0,0 +1,5 @@
1
+ polarcrawl/__init__.py,sha256=1SX36e_71J7oxZQwcEdwoQ6vrJdeLyp0imfT9b62hR8,1623
2
+ polarcrawl-0.1.0.dist-info/METADATA,sha256=Ue83dBz2hEXJJrl0qIKITDYUxKHvy1eDiFMQBPApC_s,2356
3
+ polarcrawl-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
4
+ polarcrawl-0.1.0.dist-info/licenses/LICENSE,sha256=gu7IKTjq7piJiBz9dnaL_MonwJnsJLcQE8zfsPBH-Xw,1067
5
+ polarcrawl-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PolarCrawl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.