cliqtomedia-apify: run any Apify Actor from Python or the command line
Run any public Apify Actor and get its dataset items as JSON, JSONL or CSV. One command, no dependencies.
What you get
- A
cliqtomedia-apify runcommand that starts an Actor, waits for it to finish and prints the results. - A
run_actor()function that returns the dataset items as a Python list. - Output as
json,jsonlorcsv. - Clear errors and exit codes for a missing token, a wrong Actor name and a failed run.
- Standard library only. It needs Python 3.9 or newer and installs no other packages.
The package works with any public Actor on Apify, not only ours. It reads dataset items with clean=true, so hidden helper fields are dropped.
Install
pip install cliqtomedia-apify
Get your Apify token
The package uses your own Apify account. It never ships a token.
- Create a free account at apify.com.
- In Apify Console, open Settings, then API & Integrations. Copy the Personal API token (how to find it).
- Set it as the
APIFY_TOKENenvironment variable:
export APIFY_TOKEN=your_token_here
You can also pass the token with --token on the command line or token= in Python.
Quick start: command line
cliqtomedia-apify run cliqtomedia/youtube-transcript-scraper \
--input '{"videoUrls": ["jNQXAC9IVRw"]}' --format json
Read the input from a file:
cliqtomedia-apify run cliqtomedia/youtube-transcript-scraper --input-file input.json --format jsonl > items.jsonl
| Option | Meaning |
|---|---|
--input |
Actor input as a JSON string |
--input-file |
Path to a JSON file with the Actor input |
--limit N |
Fetch at most N items |
--format |
json (default), jsonl or csv |
--timeout SECONDS |
How long to wait for the run (default 300) |
--token |
Apify token (default: APIFY_TOKEN) |
--version |
Print the package version |
Exit codes: 0 success, 1 Apify or run error, 2 usage error such as a missing token or bad input JSON.
python -m cliqtomedia_apify run ... works the same way.
Quick start: Python
from cliqtomedia_apify import run_actor
items = run_actor(
"cliqtomedia/youtube-transcript-scraper",
{"videoUrls": ["jNQXAC9IVRw"]},
limit=10,
)
print(items[0]["status"], items[0]["text"][:80])
run_actor(actor, run_input=None, *, token=None, limit=None, timeout=300) returns a list of dicts. It raises ApifyError (or the subclasses ApifyHTTPError and MissingTokenError) on failure.
Example
Input for the YouTube Transcript Scraper Actor:
{
"videoUrls": ["jNQXAC9IVRw"]
}
Output, shortened to the main fields of the first dataset item:
[
{
"status": "SUCCEEDED",
"complete": true,
"videoId": "jNQXAC9IVRw",
"canonicalUrl": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
"track": {
"sourceLanguageCode": "en",
"sourceIsGenerated": false,
"isTranslated": false
},
"segments": [
{
"sequence": 0,
"text": "All right, so here we are, in front of the elephants",
"startSeconds": 1.2,
"durationSeconds": 2.16
}
],
"segmentCount": 6
}
]
Each Actor has its own input and output fields. Read them on the Actor page.
Pricing
This package is free (MIT license). Apify charges only for your own runs, under your account. The exact price of each Actor is on its Apify page. Check it before you start.
Limits
- It runs one Actor per call and returns when the run ends. It does not stream partial results.
- It waits up to
--timeoutseconds (default 300). If the run is not done by then, the package aborts it and reports an error. - It reads at most the first
--limitdataset items. Without--limit, it reads the whole dataset. - It does not manage tasks, schedules, webhooks or key-value stores. Use the full Apify API for those.
- The run must succeed. If the Actor fails, you get an error, not partial items.
FAQ
Does it work with Actors from other authors?
Yes. Use any Actor name in the form username/actor-name.
Where does the token go?
Into the APIFY_TOKEN environment variable, or --token / token=. The package sends it only to api.apify.com.
Why do I get HTTP 401? Apify rejected the token. Copy it again from Console, Settings, API & Integrations.
Why do I get HTTP 404?
The Actor name is wrong or the Actor is private. Check the spelling, for example cliqtomedia/youtube-transcript-scraper.
Can I use it in a script or a cron job? Yes. It prints data to stdout, errors to stderr, and sets the exit code.
Links
Metadata
Release files for cliqtomedia-apify 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cliqtomedia_apify-0.1.0.tar.gz | 8.4 kB | Without provenance | Details for cliqtomedia_apify-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cliqtomedia_apify-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cliqtomedia_apify-0.1.0-py3-none-any.whl |
Total release size: 17.1 kB
Release files / cliqtomedia_apify-0.1.0.tar.gz
| Download URL | cliqtomedia_apify-0.1.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abf0105309d5ef171c6e1e1a5b3f9ff3ff461fe781574b09ef769311e10124fb
|
|
BLAKE2b-256 checksum How to use checksums |
f8add54b2c403c350086d6586063f3982d4ac8ed29090209eac5396acbd9c1cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / cliqtomedia_apify-0.1.0-py3-none-any.whl
| Download URL | cliqtomedia_apify-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3325f34f8cc07d5e31dd295be1c15f8887d2edadfa137d373be24c75e53a5f4d
|
|
BLAKE2b-256 checksum How to use checksums |
c367a71f488cb496be65c8b3ea282defb22a1a591eae556986ddd97d233329d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Security for cliqtomedia-apify 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.