# Flickr 关键词搜索 API (flickr.search)

- Canonical page: [https://everyinfra.com/flickr-api/search](https://everyinfra.com/flickr-api/search?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "flickr", "action": "search", "params": {...}}
- Price: $0.024 per call ($24 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 50 per call
- Mode: sync; add "mode": "async" for slow tasks

Flickr 关键词搜索按 `keyword` 搜公开的照片和视频，每条带标题、图片链接 `image_url`、媒体类型 `media_type`、标签 `tags`、作者名和作者 ID、拍摄时间 `taken_at` 与上传发布时间 `posted_at`。它回答「这个主题下有哪些公开图片、谁拍的、什么时候拍的」，适合找素材、做主题调研，或者找出某个题材下的摄影作者。

`media_type` 可选照片、视频或全部，这一页默认只看照片。`sort` 可以按相关度、趣味度、上传时间或拍摄时间排序，默认按相关度。`keyword` 搜的是内容，不是作者昵称的精确查询。默认 10 条，单次最多 50 条。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=flickr&action=search

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | Flickr 照片/视频搜索词；由 media_type 决定媒体范围，不是作者昵称的精确查询。 |
| media_type | not declared | no | not declared | 媒体范围：photos 仅照片、videos 仅视频、all 全部。search 默认 photos，user_posts 默认 all；这个参数不表示是否下载原始文件。 |
| sort | not declared | no | not declared | 照片/视频排序：relevance 相关度；interestingness-desc / interestingness-asc 趣味度从高到低/从低到高；date-posted-desc / date-posted-asc 上传时间从新到旧/从旧到新；date-taken-desc / date-taken-asc 拍摄时间从新到旧/从旧到新。search 默认 relevance，user_posts 默认 date-posted-desc；拍摄与上传日期不能混用。 |
| limit | integer (1–50) | no | 10 | 这次调用最多返回的条数，整数，1–50；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| media_type | 媒体类型（照片/视频）。 |
| author_name | 作者昵称（显示名）。 |
| author_id | 作者在原平台的唯一 ID。 |
| tags | 标签数组。无标签时为空数组，不是 null。 |
| taken_at | 拍摄时间，来自照片 EXIF，**与上传时间不同**，可能为 null。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "flickr",
  "action": "search",
  "params": {
    "keyword": "street photography"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "flickr",
        "action": "search",
        "params": {
            "keyword": "street photography",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "flickr",
  "action": "search",
  "results": [
    {
      "id": "•••",
      "url": "https://www.flickr.com/photos/199101808@N07/55551766234/",
      "title": "A great place to enjoy a Schwarzwälder Kirschtorte, Freiburg, Germany, 2026",
      "image_url": "https://live.staticflickr.com/65535/55551766234_9457abf045_b.jpg",
      "media_type": "image",
      "author_name": "•••",
      "author_id": "•••",
      "tags": [
        "schwarzwälderkirschtorte",
        "café",
        "blackandwhite"
      ],
      "taken_at": "2026-08-25T18:09:53-08:00",
      "posted_at": "2026-09-26T09:33:25+00:00",
      "platform": "flickr"
    },
    {
      "id": "•••",
      "url": "https://www.flickr.com/photos/189004250@N02/55551755389/",
      "title": "like a microphone",
      "image_url": "https://live.staticflickr.com/65535/55551755389_ba32644d34_b.jpg",
      "media_type": "image",
      "author_name": "•••",
      "author_id": "•••",
      "tags": [
        "nikon",
        "z8",
        "monochrome"
      ],
      "taken_at": "2026-08-05T16:23:35-08:00",
      "posted_at": "2026-09-26T09:33:55+00:00",
      "platform": "flickr"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 怎么只看视频，或者同时看照片和视频？

用 `media_type` 选范围：只要照片、只要视频或全部。这一页默认只返回照片，不传的话读不到视频；用户内容那一页默认是全部。这个参数只决定媒体范围，不表示是否下载原始文件。

### 拍摄时间和上传时间有什么不同？

`taken_at` 来自照片的 EXIF，是拍摄时间，可能为 null；`posted_at` 是上传发布的时间，ISO 8601、UTC 时区。排序也是两套：按上传时间排和按拍摄时间排不能混用。

### 搜到作者以后，怎么读他的更多作品？

结果里的 `author_id` 是 Flickr 用户 NSID，形如 12345678@N04，把它填进用户内容那一页的用户 ID 参数，就能列出这位作者的作品。用户内容要的是 NSID，不是昵称、个人主页短名或整条链接，所以 `author_name` 不能直接拿去用。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=flickr
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
