資料 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選填