RedGIFs Niche and Keyword Video Fetcher
Pricing
from $40.00 / 1,000 results
RedGIFs Niche and Keyword Video Fetcher
Fetch RedGIFs niche/keyword metadata and optionally Download MP4 Videos by Niche or Keyword.
Pricing
from $40.00 / 1,000 results
Rating
0.0
(0)
Developer
Webdesign Detail
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
4 days ago
Last modified
Categories
Share
Authorized RedGIFs Niche Video Fetcher
An unofficial Python Apify Actor that discovers RedGIFs videos from authorized keyword/niche queries, normalizes their metadata, and can save authorized MP4 files to the run's default key-value store. It uses the Apify SDK for Python 4.x, HTTPX, the integrated Apify Proxy, bounded concurrency, and reproducible Docker builds.
This project is not affiliated with, endorsed by, or operated by RedGIFs.
Mandatory authorization and adult-content notice
RedGIFs hosts sexually explicit 18+ material. Run this Actor only where every operator and viewer is legally permitted to access that material. Before every run, you must have all three of the following:
- authorization from RedGIFs for the intended automated access;
- creator/rightsholder permission to download and store every requested video; and
- a lawful adult-use basis in every applicable jurisdiction.
Set contentRightsAcknowledged to true only when those conditions are satisfied. The checkbox records your acknowledgement; it does not create or prove permission. You remain responsible for the source's terms, privacy and publicity rights, copyright, retention, redistribution, and access controls. Do not use this Actor to bypass authentication, paywalls, technical restrictions, takedowns, or geographic/legal restrictions.
Why HTTPX instead of BeautifulSoup or Playwright?
The niche page is a React/Vite shell, so parsing its initial HTML with BeautifulSoup does not provide the product records. The authorized data path returns structured JSON and direct media URLs, which HTTPX can fetch without rendering a browser. Leaving Playwright out keeps the image smaller, startup faster, and resource usage lower.
The RedGIFs JSON interface used here is private and undocumented. It can change without notice. All endpoint-specific behavior is isolated in the RedGIFs client so it can be updated without changing the storage contract.
How a run works
The Actor:
- validates the authorization acknowledgement, download budgets, and standard
proxyConfigurationinput; - rejects direct connections and custom proxies unless
useApifyProxyistrue; - creates one sticky Apify Proxy session and stable user agent for temporary authentication, metadata pages, and media streams;
- resolves each keyword to a niche slug, follows one source-provided rename safely, and optionally falls back to general keyword search;
- paginates with bounded retries and deduplicates records by RedGIFs video ID;
- optionally streams each MP4 to temporary disk, validates its type/size, and streams it into the
platform key-value store under
video-<id>-<quality>.mp4without loading the whole file into RAM; - publishes each dataset record as soon as its item finishes, so an abort, a timeout, or a platform migration never discards completed work; and
- writes
RUN_SUMMARYtelemetry plus aRUN_STATEmigration checkpoint to the default key-value store.
Authentication tokens, proxy credentials, and media bytes are never written to logs or dataset items.
Input
Minimal input:
{"keywords": ["authorized-niche"],"contentRightsAcknowledged": true,"proxyConfiguration": {"useApifyProxy": true}}
Useful controls include:
| Field | Default | Purpose |
|---|---|---|
matchMode | nicheThenSearch | Use only a niche or fall back to keyword search. |
sort | hot | Request hot, latest, or top ordering. |
maxItemsPerKeyword | 100 | Bound metadata results independently for each query. |
downloadVideos | true | Store MP4 files as key-value records. |
videoQuality | best | Prefer HD, require HD, or require SD. |
maxVideoBytes | 262144000 | Stop an individual file above 250 MiB. |
maxTotalDownloadBytes | 1073741824 | Stop storing files after 1 GiB in a run. |
downloadConcurrency | 2 | Bound simultaneous media streams. |
requestTimeoutSecs | 45 | HTTP operation timeout. |
maxRequestRetries | 4 | Bounded transient retry count. |
With nicheThenSearch, a missing or renamed niche falls back to keyword search unless RedGIFs
provides a replacement slug, in which case the Actor follows that replacement once. nicheOnly is
strict: a missing or renamed niche without a usable replacement fails that keyword with an
actionable message instead of reporting a misleading empty result.
The Actor fails before source access if the rights acknowledgement is not true or the integrated Apify Proxy is not enabled. Your Apify account must also have proxy access for the requested configuration.
Output and video downloads
Every default-dataset row contains the input query, discovery source, video ID/page URL, description, creator, tags/niches, creation time, duration, dimensions, audio/view/like metadata, thumbnail, selected quality, and download outcome. Successful downloads also include kvsKey, filename, mime, size, and downloadUrl. A sanitized per-item error is present when an item cannot be completed.
MP4 files are in the default key-value store's videos collection. The Output tab links to the dataset, that collection, and RUN_SUMMARY. A generated downloadUrl is subject to the key-value store's access permissions and retention; it is not a permanent hosting guarantee. Download or copy files before their storage expires.
By default, unnamed Apify datasets and key-value stores expire after seven days. Named storages can have different retention. Video downloads incur proxy traffic, platform data transfer, storage, compute, and possibly residential proxy costs. Keep item, byte, and concurrency limits conservative and review the live Apify pricing for your account before a large run.
Local development
Prerequisites: Python 3.13, uv, the Apify CLI, an authenticated Apify account, and integrated-proxy entitlement.
uv syncapify loginapify run
For local Apify storage emulation, place the input at storage/key_value_stores/default/INPUT.json. Never commit access tokens, proxy credentials, .env files, or local storage.
Run the focused checks with:
uv run ruff check .uv run ruff format --check .uv run pytest --cov --cov-report=term-missingapify validate-schema
Tests run entirely against sanitized synthetic fixtures in tests/fixtures/. They contain no adult media and make no live RedGIFs request. Coverage is gated at 80 percent.
Docker
The production image uses the official apify/actor-python:3.13 base pinned to its multi-architecture manifest digest. Its uv helper image is digest-pinned as well. The build installs only packages locked in uv.lock, copies dependency metadata before source files for efficient layer caching, and runs as the base image's non-root myuser account.
$docker build -t authorized-redgifs-video-fetcher:local .
The container entrypoint is python -m src. Use apify run for normal local execution because it configures the Actor environment and storage paths correctly.
Deployment status
The repository contains Actor definitions suitable for CI/CD, but this README does not claim that any GitHub workflow, cloud build, production tag, or Apify Store publication has completed. Store publication remains a separate manual legal, content-policy, security, and billing review.
Workflows
CI and beta deployment runs on every pull request and every push to main.
quality: locked dependency install, Ruff lint and format checks, byte compilation, the test suite behind an 80 percent coverage gate, andapify validate-schema.docker: alinux/amd64container build, in parallel withquality.deploy-beta: only on a push tomain, only after both jobs above pass, and gated on theapify-betaGitHub environment. It pushes a build taggedbeta, runs a one-item metadata smoke against that exact build number, and verifiesSUCCEEDED,RUN_SUMMARY, and a non-empty dataset.
beta is not the tag normal runs resolve to, so a merge never changes what an existing user gets.
The beta smoke does make one authorized metadata request to the target after a successful push.
Release latest Actor build is manual dispatch only. It requires the exact successful beta build ID
and the confirm_release checkbox, and it is gated on the apify-production GitHub environment. It
runs a bounded one-video smoke against that exact build, verifies the MP4 record, and then moves the
latest tag to the already-tested build without rebuilding it. Because latest is the tag normal
runs resolve to, this is the step that changes production behavior.
First-time setup
The Actor must exist on Apify before the workflows can target it, so create it from a workstation
first with apify push --build-tag beta. Then create both the apify-beta and apify-production
GitHub environments and configure these repository or environment secrets:
APIFY_TOKEN: token allowed to build, run, inspect, and retag this Actor;APIFY_ACTOR_ID: the Actor ID;APIFY_SMOKE_KEYWORD: an authorized query used for the metadata-only beta smoke; andAPIFY_VIDEO_SMOKE_KEYWORD: an authorized query whose first result may be downloaded during the manual production gate.
Add required reviewers to apify-production if releases should need approval. The smoke keywords
are secrets so the workflow does not hardcode or expose the authorized target selection.
.actorignore keeps caches, virtualenvs, tests, and local storage out of what is uploaded to the platform.
Operational limitations
- A source API change can break discovery or downloads even when the website UI still works.
- Dataset rows are written in completion order rather than discovery order, because items are published as they finish.
- On Apify, validated files are uploaded to KVS with a streaming authenticated PUT. Local storage emulation still uses the SDK value interface, so keep local test file limits conservative.
- This Actor deliberately does not crawl RedGIFs watch pages and does not include a browser fallback.
For Apify lifecycle, storage, proxy, and deployment behavior, see the Apify SDK for Python documentation, Actor definition documentation, and storage documentation.