Read a post and its comment thread
curl --request POST \
--url https://api.stophy.dev/v1/reddit/post \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"post": "<string>",
"sort": "best",
"depth": 5,
"limit": 200
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({post: '<string>', sort: 'best', depth: 5, limit: 200})
};
fetch('https://api.stophy.dev/v1/reddit/post', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/reddit/post"
payload = {
"post": "<string>",
"sort": "best",
"depth": 5,
"limit": 200
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"post": {
"type": "post",
"url": "<string>",
"score": 0,
"comments": 0,
"isNsfw": true,
"isVideo": true,
"isPinned": true,
"id": "<string>",
"title": "<string>",
"text": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"subreddit": "<string>",
"upvotePercent": 50,
"createdAt": "2023-11-07T05:31:56Z",
"flair": "<string>",
"link": {
"url": "<string>",
"title": "<string>",
"description": "<string>",
"image": "<string>"
},
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"video": {
"url": "<string>",
"hls": "<string>",
"durationSeconds": 123
},
"poll": {
"options": [
{
"text": "<string>",
"votes": 0
}
],
"totalVotes": 0,
"endsAt": "2023-11-07T05:31:56Z"
},
"repostOf": {
"id": "<string>",
"url": "<string>",
"subreddit": "<string>",
"title": "<string>"
}
},
"comments": [
{
"url": "<string>",
"score": 0,
"depth": 0,
"isSubmitter": true,
"isPinned": true,
"id": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"text": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"children": "<array>",
"repliesCursor": "<string>"
}
],
"commentsCursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}Reddit
Reddit post API
Call the Reddit post API to get post, comments and comments cursor, as JSON or markdown. 2 credits.
POST
/
v1
/
reddit
/
post
Read a post and its comment thread
curl --request POST \
--url https://api.stophy.dev/v1/reddit/post \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"post": "<string>",
"sort": "best",
"depth": 5,
"limit": 200
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({post: '<string>', sort: 'best', depth: 5, limit: 200})
};
fetch('https://api.stophy.dev/v1/reddit/post', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/reddit/post"
payload = {
"post": "<string>",
"sort": "best",
"depth": 5,
"limit": 200
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"post": {
"type": "post",
"url": "<string>",
"score": 0,
"comments": 0,
"isNsfw": true,
"isVideo": true,
"isPinned": true,
"id": "<string>",
"title": "<string>",
"text": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"subreddit": "<string>",
"upvotePercent": 50,
"createdAt": "2023-11-07T05:31:56Z",
"flair": "<string>",
"link": {
"url": "<string>",
"title": "<string>",
"description": "<string>",
"image": "<string>"
},
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"video": {
"url": "<string>",
"hls": "<string>",
"durationSeconds": 123
},
"poll": {
"options": [
{
"text": "<string>",
"votes": 0
}
],
"totalVotes": 0,
"endsAt": "2023-11-07T05:31:56Z"
},
"repostOf": {
"id": "<string>",
"url": "<string>",
"subreddit": "<string>",
"title": "<string>"
}
},
"comments": [
{
"url": "<string>",
"score": 0,
"depth": 0,
"isSubmitter": true,
"isPinned": true,
"id": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"text": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"children": "<array>",
"repliesCursor": "<string>"
}
],
"commentsCursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}- Endpoint:
reddit.post - Returns:
datahaspost,comments,commentsCursor. - Cost: 2 credits. Failed calls cost nothing.
- Paging: No.
Example
import { Stophy } from "stophy";
const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
const result = await stophy.reddit.post({ post: "https://www.reddit.com/r/rust/comments/1c8x9k2/why_i_switched_to_rust/" });
console.log(result.data.post);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.reddit.post(post="https://www.reddit.com/r/rust/comments/1c8x9k2/why_i_switched_to_rust/")
print(result["data"]["post"])
curl -X POST https://api.stophy.dev/v1/reddit/post \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"post":"https://www.reddit.com/r/rust/comments/1c8x9k2/why_i_switched_to_rust/"}'
stophy reddit post https://www.reddit.com/r/rust/comments/1c8x9k2/why_i_switched_to_rust/
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json