← All plugins

Reddit

Read Reddit searches, subreddit feeds and comment threads using the signed-in browser session.

reddit v1.0.0 3 commands

reddit/subreddit

read-only

Posts of one subreddit, as its Hot, New, Top or Rising tab lists them (pinned posts included, ads skipped).

await page.runPlugin("reddit/subreddit", { name: "<name>" })

Arguments

NameTypeDefaultDescription
namerequiredstring
min length 1
"rust", "r/rust" or the subreddit URL.
sort"hot" | "new" | "top" | "rising""hot"
time"hour" | "day" | "week" | "month" | "year" | "all"Time range for sort "top" (default day).
limitinteger
1–100
25Maximum number of posts.

Returns

{
  subreddit: string,
  sort: string,
  time?: string | null,
  posts: {
    id: string,
    subreddit: string,
    title: string,
    author: string,
    score: integer | null,
    comments: integer,
    created: string,
    url: string,
    link: string | null,
    nsfw?: boolean
  }[]
}

reddit/thread

read-only

One post with its text and nested comments. "Load more" and "continue this thread" stubs are skipped and counted in omitted.

await page.runPlugin("reddit/thread")

Arguments

NameTypeDefaultDescription
urlstringPost or comment URL on reddit.com (www, old, new), a redd.it link, or a /r/<name>/s/<code> share link.
idstring
/^(t3_)?[a-z0-9]{1,13}$/
Post id such as "1y7in56" (instead of url).
limitinteger
0–500
50Maximum number of comments, counted across all levels; 0 for the post only.
depthinteger
1–10
3Reply levels to include; 1 for top-level comments only.
sort"best" | "top" | "new" | "controversial" | "old" | "qa""best"Comment order.

Returns

{
  post: {
    id: string,
    subreddit: string,
    title: string,
    author: string,
    score: integer | null,
    comments: integer,
    created: string,
    url: string,
    link: string | null,
    nsfw?: boolean,
    selftext: string,
    locked?: boolean,
    removed?: boolean
  },
  comments: {
    id: string,
    author: string,
    score: integer | null,
    created: string,
    text: string,
    op?: boolean,
    stickied?: boolean,
    replies: {
      id: string,
      author: string,
      score: integer | null,
      created: string,
      text: string,
      op?: boolean,
      stickied?: boolean,
      replies: …[]
    }[]
  }[],
  omitted: {
    comments: integer,
    stubs: integer
  }
}