# Giphy Scraper (keyless) (`subimpact/giphy-scraper`) Actor

No API key needed. Scrape Giphy's official API: search, trending, stickers, clips, emoji, translate, random, by-id, categories. Deep pagination, direct GIF/WebP/MP4 download, optional user API key override.

- **URL**: https://apify.com/subimpact/giphy-scraper.md
- **Developed by:** [subimpact](https://apify.com/subimpact) (community)
- **Categories:** Social media, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Keyless Giphy Scraper

Scrape GIFs, stickers, clips and emoji from the official Giphy public API — **no API key required**.

### Why keyless?

Giphy's public API officially requires a user API key: beta keys are rate-limited
(~100 calls/hour) and production keys need human review + paid pricing. This actor
reuses the same public web-client key that Giphy's own website embeds, so plain HTTP
calls work with **no key, no browser, no proxy, no rate limiting**. Users who have
their own key can override via the `apiKey` input (or `GIPHY_API_KEY` env var).

### Modes

| mode | endpoint | input |
|---|---|---|
| `search` | `/v1/gifs/search` (+ `/v1/stickers/search`, `/v1/clips/search` opt-in) | `searchTerms[]` |
| `trending` | `/v1/gifs/trending` + `/v1/stickers/trending` | — |
| `byIds` | `/v1/gifs?ids=` | `gifIds[]` |
| `random` | `/v1/gifs/random` | `randomTags[]` |
| `translate` | `/v1/gifs/translate` | `translateText` |
| `categories` | `/v1/gifs/categories` | — |
| `emoji` | `/v1/emoji` | — |

Search mode hits `/v1/stickers/search` for each term by default (`includeStickers`),
and `/v1/clips/search` when `includeClips` is on. Clips carry `mp4_720` variants.

### Inputs

- `mode` — endpoint to hit (default `search`)
- `searchTerms[]` — one API call per term (default `["funny cat"]`)
- `gifIds[]`, `randomTags[]`, `translateText` — mode-specific payloads
- `limit` — items per term/call, hard-capped at **150** by the API (200+ returns empty)
- `offset` — pagination start (`deepPagination` walks `offset += limit` until an empty
  page or `limit*3` pages, because Giphy deep pagination dies silently around ~250)
- `rating` (`g/pg/pg-13/r`), `lang`
- `downloadMedia` — download each file (GIF/WebP/MP4) into the run's default key-value
  store; records get `localFilePath` + `kvsUrl` (`https://api.apify.com/v2/key-value-stores/{storeId}/records/{key}`)
- `downloadFormat` — `preview` (preview\_gif), `downsized`, `original` (default `preview`)
- `maxDownloadSizeMb` — skip files larger than this (checked against `images[].size`)

### Output record

`giphyId`, `gifType` (gif/sticker/clip/emoji/category), `url`, `gifTitle`, `altText`, `username`,
`userDisplayName`, `userVerified`, `userAvatarUrl`, `rating`, `source`, `tags[]`,
`createDatetime`, `trendingDatetime`, `embedUrl`, `bitlyUrl`,
`variantUrls.{preview,downsized,original,mp4}` (url + size + width + height; empty
variants kept as `{url:""}`), optional `searchTerm`, and `localFilePath`/`kvsUrl`
when media download is enabled.

### Robustness

- 20 s per-request timeout, up to 3 retries with exponential backoff on 5xx/429/network errors
- Hard stop with a clear error if the key is rejected twice (401/403) — suggests the
  `apiKey` input in case Giphy rotates the embedded key
- Empty `data` arrays and `meta.status != 200` are logged and skipped, never fatal
- Non-200 media downloads are skipped without killing the run

### Local development

```bash
python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
python -m pytest tests/ -v    # live-network tests (real API, default key)
apify push                    # push a new PRIVATE build
```

# Actor input Schema

## `mode` (type: `string`):

Which Giphy endpoint to hit

## `searchTerms` (type: `array`):

Terms to search (search mode). Each term = one API call.

## `gifIds` (type: `array`):

Explicit Giphy IDs for byIds mode

## `randomTags` (type: `array`):

Tags for random mode

## `translateText` (type: `string`):

Text for translate mode

## `limit` (type: `integer`):

Items per term. Hard cap 150 per API.

## `offset` (type: `integer`):

Pagination offset

## `deepPagination` (type: `boolean`):

Keep paging (offset += limit) until empty page or limit\*3 pages reached

## `includeStickers` (type: `boolean`):

Also hit /v1/stickers/search for each term

## `includeClips` (type: `boolean`):

Also hit /v1/clips/search for each term (clips have mp4\_720 variants)

## `rating` (type: `string`):

Content rating filter.

## `lang` (type: `string`):

Language (ISO 639-1, e.g. en, es).

## `downloadMedia` (type: `boolean`):

Download each GIF/WebP/MP4 file into the run (stored in the run's default key-value store, dataset record gets a localFilePath + kvsUrl field).

## `downloadFormat` (type: `string`):

Which image variant to download (preview=preview\_gif/url small, downsized=downsized media, original=original)

## `maxDownloadSizeMb` (type: `integer`):

Skip files larger than this (check images\[].size before downloading)

## `apiKey` (type: `string`):

Optional user's own Giphy API key. Defaults to the embedded public web-client key (no key needed).

## Actor input object example

```json
{
  "mode": "search",
  "searchTerms": [
    "funny cat"
  ],
  "randomTags": [
    "cat"
  ],
  "limit": 50,
  "offset": 0,
  "deepPagination": false,
  "includeStickers": true,
  "includeClips": false,
  "rating": "g",
  "lang": "en",
  "downloadMedia": false,
  "downloadFormat": "preview",
  "maxDownloadSizeMb": 10
}
```

# Actor output Schema

## `giphyId` (type: `string`):

Giphy ID of the GIF/sticker/clip

## `gifType` (type: `string`):

gif | sticker | clip | emoji | category

## `url` (type: `string`):

giphy.com page URL

## `gifTitle` (type: `string`):

GIF title

## `altText` (type: `string`):

Accessibility alt text

## `username` (type: `string`):

Uploader username

## `userDisplayName` (type: `string`):

Uploader display name

## `userVerified` (type: `string`):

Uploader verified badge

## `userAvatarUrl` (type: `string`):

Uploader avatar URL

## `rating` (type: `string`):

g | pg | pg-13 | r

## `source` (type: `string`):

Source URL or empty

## `tags` (type: `string`):

Giphy tags

## `createDatetime` (type: `string`):

ISO created timestamp

## `trendingDatetime` (type: `string`):

ISO trending timestamp

## `embedUrl` (type: `string`):

giphy.com/embed/{id}

## `bitlyUrl` (type: `string`):

Short link

## `variantUrls` (type: `string`):

preview/downsized/original/mp4 URLs + dims

## `localFilePath` (type: `string`):

Set when downloadMedia=true

## `kvsUrl` (type: `string`):

Downloaded file URL in run key-value store

## `searchTerm` (type: `string`):

Term that produced this result

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("subimpact/giphy-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("subimpact/giphy-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call subimpact/giphy-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,subimpact/giphy-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/A5f5iHJsHmHhc5y2F/builds/zHySkN2frTO0z408P/openapi.json
