Reddit Subreddit Posts

reddit_subreddit_posts

Fetch a list of posts from a subreddit with specified sorting and count

Category: socialTimeout: 3600s• Retryable

Input schema

POST this shape to /api/v1/tasks as the input field when creating a task in a group of type reddit_subreddit_posts.

{
  "type": "object",
  "properties": {
    "subredditName": {
      "type": "string",
      "description": "The subreddit name (without r/ prefix)",
      "pattern": "^[A-Za-z0-9_]{3,21}$",
      "examples": [
        "programming",
        "ChatGPT"
      ],
      "x-ui": {
        "label": "Subreddit Name",
        "placeholder": "Subreddit name (without r/ prefix)",
        "component": "input"
      }
    },
    "sortBy": {
      "type": "string",
      "description": "Sort method for posts",
      "enum": [
        "best",
        "hot",
        "new",
        "top",
        "rising"
      ],
      "examples": [
        "hot",
        "new"
      ],
      "x-ui": {
        "label": "Sort By",
        "placeholder": "Select sort method",
        "component": "select",
        "options": [
          {
            "value": "best",
            "label": "Best"
          },
          {
            "value": "hot",
            "label": "Hot"
          },
          {
            "value": "new",
            "label": "New"
          },
          {
            "value": "top",
            "label": "Top"
          },
          {
            "value": "rising",
            "label": "Rising"
          }
        ]
      }
    },
    "count": {
      "type": "integer",
      "description": "Number of posts to fetch",
      "minimum": 1,
      "maximum": 1000,
      "examples": [
        10,
        25
      ],
      "x-ui": {
        "label": "Count",
        "placeholder": "Number of posts (1-100)",
        "component": "number"
      }
    }
  },
  "required": [
    "subredditName",
    "sortBy",
    "count"
  ]
}

Output schema

Executors submit their output matching this shape to /api/v1/tasks/[taskId]/submit. Readers pull it back from task detail endpoints.

{
  "type": "object",
  "properties": {
    "posts": {
      "type": "array",
      "description": "Array of posts",
      "items": {
        "type": "object",
        "properties": {
          "author": {
            "type": "string",
            "description": "Reddit username of the post author"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Post creation timestamp (ISO 8601 format)"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "image",
              "video",
              "link",
              "gallery"
            ],
            "description": "Post type"
          },
          "title": {
            "type": "string",
            "description": "Post title"
          },
          "flair": {
            "type": [
              "string",
              "null"
            ],
            "description": "Post flair text"
          },
          "content": {
            "type": "object",
            "description": "Content data (structure varies by type)",
            "oneOf": [
              {
                "type": "object",
                "description": "Text post content",
                "properties": {
                  "body": {
                    "type": "string",
                    "description": "Post text content"
                  }
                },
                "required": [
                  "body"
                ]
              },
              {
                "type": "object",
                "description": "Image post content",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Image URL"
                  },
                  "width": {
                    "type": "integer",
                    "description": "Image width in pixels"
                  },
                  "height": {
                    "type": "integer",
                    "description": "Image height in pixels"
                  }
                },
                "required": [
                  "url"
                ]
              },
              {
                "type": "object",
                "description": "Video post content",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Video URL"
                  },
                  "duration": {
                    "type": "integer",
                    "description": "Video duration in seconds"
                  },
                  "width": {
                    "type": "integer",
                    "description": "Video width in pixels"
                  },
                  "height": {
                    "type": "integer",
                    "description": "Video height in pixels"
                  }
                },
                "required": [
                  "url"
                ]
              },
              {
                "type": "object",
                "description": "Link post content",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "External link URL"
                  },
                  "thumbnail": {
                    "type": "string",
                    "description": "Thumbnail image URL"
                  }
                },
                "required": [
                  "url"
                ]
              },
              {
                "type": "object",
                "description": "Gallery post content",
                "properties": {
                  "images": {
                    "type": "array",
                    "description": "Array of images",
                    "items": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "Image URL"
                        },
                        "width": {
                          "type": "integer",
                          "description": "Image width in pixels"
                        },
                        "height": {
                          "type": "integer",
                          "description": "Image height in pixels"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    }
                  }
                },
                "required": [
                  "images"
                ]
              }
            ]
          },
          "upvotes": {
            "type": "integer",
            "description": "Number of upvotes"
          },
          "comments": {
            "type": "integer",
            "description": "Number of comments"
          },
          "awards": {
            "type": "integer",
            "description": "Number of awards"
          },
          "url": {
            "type": "string",
            "description": "Full URL of the post"
          }
        },
        "required": [
          "author",
          "createdAt",
          "type",
          "title",
          "content",
          "upvotes",
          "comments",
          "awards",
          "url"
        ]
      }
    }
  },
  "required": [
    "posts"
  ]
}

Ready to run Reddit Subreddit Posts?

Create a project, approve an executor, and push your first reddit_subreddit_posts task.

Get started
Tskgone — Distributed Task Scraping Platform