Felo API PlatformFelo API Platform

Data API / Reddit / Subreddit

Search Within Subreddit

Searches inside one subreddit and returns matching posts with a cursor token to page. Posts carry title, author, selftext, score, ups, upvote_ratio, num_comments, created_utc, created_at_iso, url, permalink and is_video. Despite what sort suggests, every sort value returns posts and only posts: comments and media were confirmed absent from all five. For the replies under a result, pass its url to get_reddit_post_comments.

Параметры

запрос

  • subredditstringОбязательный

    Subreddit name (e.g. 'Fitness', not 'r/Fitness' or a full URL)

  • querystringНеобязательный

    Search query to find matching content

  • sortstringНеобязательный

    Допустимые значения: relevance · hot · top · new · comments

    Sort order. For posts/media: relevance, hot, top, new, comments. For comments: relevance, top, new

  • timeframestringНеобязательный

    Допустимые значения: all · year · month · week · day · hour

    Timeframe to filter results

  • cursorstringНеобязательный

    Cursor to get more results. Get 'cursor' from previous response.

Пример запроса

curl -G "https://openapi.felo.ai/v1/beta/reddit/subreddit/search" \
  --data-urlencode "subreddit=<string>" \
  -H "Authorization: Bearer $FELO_API_KEY"

Ответ

Пример ответа

{
  "posts": [
    {
      "id": "t3_8gmjrb",
      "post_id": "t3_8gmjrb",
      "title": "Is doing 50-100 pushups a day doing anything?",
      "url": "https://www.reddit.com/r/Fitness/comments/8gmjrb/is_doing_50100_pushups_a_day_doing_anything/",
      "permalink": "/r/Fitness/comments/8gmjrb/is_doing_50100_pushups_a_day_doing_anything/",
      "nsfw": false,
      "spoiler": false,
      "is_crosspost": false,
      "subreddit": {
        "id": "t5_2qhx4",
        "name": "Fitness",
        "nsfw": false,
        "quarantined": false,
        "icon": "https://b.thumbs.redditmedia.com/Ted4KOMuRbaCYlDS55cTqjpVVZ2ENHKtYFbBFjI1i2o.png",
        "banner": null,
        "description": "A place for the pursuit of physical fitness goals.\n\nPlease see the r/Fitness Wiki and FAQ at https://thefitness.wiki for help with common questions.",
        "weekly_visitors": 898726,
        "weekly_contributions": 1827
      },
      "votes": 1414,
      "num_comments": 582,
      "created_at": "2018-05-03T01:09:17.620000+0000",
      "created_at_iso": "2018-05-03T01:09:17.620Z",
      "thumbnail": null,
      "thumbnail_blurred": false,
      "position": 0,
      "relative_position": 0
    }
  ],
  "comments": [
    {
      "id": "t1_nxf7p27",
      "post_id": "t3_1q2p898",
      "parent_comment_id": null,
      "is_reply_to_comment": false,
      "author": "Philser23",
      "author_avatar": null,
      "author_nsfw": false,
      "body": "On the 30th my girlfriend out of the blue decided her new year's resolution would be to start going to the gym. I was so excited since none of my partners ever shared the fitness hobby with me.",
      "body_html": "<p>On the 30th my girlfriend out of the blue decided her new year's resolution would be to start going to the gym...</p>",
      "images": [],
      "votes": 123,
      "url": "https://www.reddit.com/r/Fitness/comments/1q2p898/gym_story_saturday/nxf7p27/",

Показана часть. Полный пример — в справочнике API.

Поля ответа

  • successbooleanНеобязательный
  • credits_remainingintegerНеобязательный
  • postsobject[]Необязательный
  • afterНеобязательный
  • cursorНеобязательный