scrapebadger 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.cts +1347 -9
- package/dist/index.d.ts +1347 -9
- package/dist/index.js +641 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +637 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -426,7 +426,7 @@ interface ItemDetailResponse {
|
|
|
426
426
|
/**
|
|
427
427
|
* Response from the user profile endpoint.
|
|
428
428
|
*/
|
|
429
|
-
interface UserProfileResponse {
|
|
429
|
+
interface UserProfileResponse$1 {
|
|
430
430
|
/** Full user profile */
|
|
431
431
|
user: VintedUserProfile;
|
|
432
432
|
/** Market code used */
|
|
@@ -528,7 +528,7 @@ interface VintedSearchParams {
|
|
|
528
528
|
* });
|
|
529
529
|
* ```
|
|
530
530
|
*/
|
|
531
|
-
declare class SearchClient$
|
|
531
|
+
declare class SearchClient$2 {
|
|
532
532
|
private readonly client;
|
|
533
533
|
constructor(client: BaseClient);
|
|
534
534
|
/**
|
|
@@ -623,7 +623,7 @@ declare class ItemsClient {
|
|
|
623
623
|
* }
|
|
624
624
|
* ```
|
|
625
625
|
*/
|
|
626
|
-
declare class UsersClient {
|
|
626
|
+
declare class UsersClient$1 {
|
|
627
627
|
private readonly client;
|
|
628
628
|
constructor(client: BaseClient);
|
|
629
629
|
/**
|
|
@@ -647,7 +647,7 @@ declare class UsersClient {
|
|
|
647
647
|
*/
|
|
648
648
|
getProfile(userId: number, options?: {
|
|
649
649
|
market?: string;
|
|
650
|
-
}): Promise<UserProfileResponse>;
|
|
650
|
+
}): Promise<UserProfileResponse$1>;
|
|
651
651
|
/**
|
|
652
652
|
* Get items listed by a user.
|
|
653
653
|
*
|
|
@@ -821,11 +821,11 @@ declare class ReferenceClient {
|
|
|
821
821
|
*/
|
|
822
822
|
declare class VintedClient {
|
|
823
823
|
/** Client for item search operations */
|
|
824
|
-
readonly search: SearchClient$
|
|
824
|
+
readonly search: SearchClient$2;
|
|
825
825
|
/** Client for individual item operations */
|
|
826
826
|
readonly items: ItemsClient;
|
|
827
827
|
/** Client for user operations */
|
|
828
|
-
readonly users: UsersClient;
|
|
828
|
+
readonly users: UsersClient$1;
|
|
829
829
|
/** Client for reference data (brands, colors, statuses, markets) */
|
|
830
830
|
readonly reference: ReferenceClient;
|
|
831
831
|
/**
|
|
@@ -966,20 +966,36 @@ interface HotelsDetailsParams {
|
|
|
966
966
|
check_out: string;
|
|
967
967
|
}
|
|
968
968
|
interface TrendsInterestParams {
|
|
969
|
+
/** Up to 5 comma-separated terms. */
|
|
969
970
|
q: string;
|
|
971
|
+
/** Geographic location code (empty = worldwide). */
|
|
970
972
|
geo?: string;
|
|
973
|
+
/** Time range — e.g. `now 1-H`, `today 12-m`, `all`, or `YYYY-MM-DD YYYY-MM-DD`. */
|
|
971
974
|
date?: string;
|
|
975
|
+
/** Category filter id (0 = all). */
|
|
976
|
+
category?: number;
|
|
977
|
+
/** Property filter — `""`, `images`, `news`, `froogle`, or `youtube`. */
|
|
978
|
+
gprop?: string;
|
|
972
979
|
}
|
|
973
980
|
interface TrendsRegionsParams {
|
|
974
981
|
q: string;
|
|
975
982
|
geo?: string;
|
|
983
|
+
date?: string;
|
|
984
|
+
/** Region granularity — `auto` (default), `COUNTRY`, `REGION`, `DMA`, or `CITY`. */
|
|
985
|
+
resolution?: "auto" | "COUNTRY" | "REGION" | "DMA" | "CITY";
|
|
976
986
|
}
|
|
977
987
|
interface TrendsRelatedParams {
|
|
978
988
|
q: string;
|
|
979
989
|
geo?: string;
|
|
990
|
+
date?: string;
|
|
980
991
|
}
|
|
981
992
|
interface TrendsTrendingParams {
|
|
993
|
+
/** Country code (ISO 3166 alpha-2). Defaults to `US`. */
|
|
982
994
|
geo?: string;
|
|
995
|
+
/** Language code (e.g. `en-US`). */
|
|
996
|
+
hl?: string;
|
|
997
|
+
/** Look-back window — Google supports `24` (default), `48`, `168` (= 1 week). */
|
|
998
|
+
hours?: number;
|
|
983
999
|
}
|
|
984
1000
|
type TrendsCategory = "all" | "business" | "entertainment" | "health" | "sci_tech" | "sports" | "top_stories" | "b" | "e" | "m" | "t" | "s" | "h";
|
|
985
1001
|
type TrendsTrendingStatus = "all" | "active";
|
|
@@ -1254,6 +1270,8 @@ interface ProductsDetailParams {
|
|
|
1254
1270
|
q: string;
|
|
1255
1271
|
gl?: string;
|
|
1256
1272
|
hl?: string;
|
|
1273
|
+
/** Google domain used to localise the SERP that yields oapv session tokens. */
|
|
1274
|
+
domain?: string;
|
|
1257
1275
|
/** Extra IDs Google surfaces on Shopping tiles. Improves routing accuracy. */
|
|
1258
1276
|
catalog_id?: string;
|
|
1259
1277
|
image_docid?: string;
|
|
@@ -1263,6 +1281,12 @@ interface ProductsDetailParams {
|
|
|
1263
1281
|
include_offers?: boolean;
|
|
1264
1282
|
/** When true, also fetches `/async/toy_v` for size/colour variants. */
|
|
1265
1283
|
include_variants?: boolean;
|
|
1284
|
+
/**
|
|
1285
|
+
* Only meaningful with `include_offers=true`. When true, browser-renders
|
|
1286
|
+
* the Shopping SERP so additional merchant deep URLs surface from the
|
|
1287
|
+
* rendered HTML. Adds ~5–8 s latency.
|
|
1288
|
+
*/
|
|
1289
|
+
resolve_deep_urls?: boolean;
|
|
1266
1290
|
}
|
|
1267
1291
|
interface ShortsSearchParams {
|
|
1268
1292
|
q: string;
|
|
@@ -1722,7 +1746,7 @@ declare class ScholarClient {
|
|
|
1722
1746
|
* }
|
|
1723
1747
|
* ```
|
|
1724
1748
|
*/
|
|
1725
|
-
declare class SearchClient {
|
|
1749
|
+
declare class SearchClient$1 {
|
|
1726
1750
|
private readonly client;
|
|
1727
1751
|
constructor(client: BaseClient);
|
|
1728
1752
|
/**
|
|
@@ -1918,7 +1942,7 @@ declare class VideosClient {
|
|
|
1918
1942
|
*/
|
|
1919
1943
|
declare class GoogleClient {
|
|
1920
1944
|
/** Google Web Search (SERP) — with optional deferred AI Overview follow-up. */
|
|
1921
|
-
readonly search: SearchClient;
|
|
1945
|
+
readonly search: SearchClient$1;
|
|
1922
1946
|
/** Google Maps — places, reviews, photos, posts. */
|
|
1923
1947
|
readonly maps: MapsClient;
|
|
1924
1948
|
/** Google News — articles, topics, trending. */
|
|
@@ -1956,6 +1980,1318 @@ declare class GoogleClient {
|
|
|
1956
1980
|
constructor(client: BaseClient);
|
|
1957
1981
|
}
|
|
1958
1982
|
|
|
1983
|
+
/**
|
|
1984
|
+
* TypeScript types for Reddit API responses.
|
|
1985
|
+
*
|
|
1986
|
+
* This module contains all the data types used by the Reddit API client.
|
|
1987
|
+
*/
|
|
1988
|
+
/**
|
|
1989
|
+
* A preview image with dimensions.
|
|
1990
|
+
*/
|
|
1991
|
+
interface RedditPreviewImage {
|
|
1992
|
+
/** Image URL */
|
|
1993
|
+
url: string;
|
|
1994
|
+
/** Image width in pixels */
|
|
1995
|
+
width: number;
|
|
1996
|
+
/** Image height in pixels */
|
|
1997
|
+
height: number;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* Embedded media attached to a post.
|
|
2001
|
+
*/
|
|
2002
|
+
interface RedditMedia {
|
|
2003
|
+
/** Media type identifier */
|
|
2004
|
+
type: string | null;
|
|
2005
|
+
/** Direct media URL */
|
|
2006
|
+
url: string | null;
|
|
2007
|
+
/** Thumbnail URL */
|
|
2008
|
+
thumbnail_url: string | null;
|
|
2009
|
+
/** Media width in pixels */
|
|
2010
|
+
width: number | null;
|
|
2011
|
+
/** Media height in pixels */
|
|
2012
|
+
height: number | null;
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* An award given to a post or comment.
|
|
2016
|
+
*/
|
|
2017
|
+
interface RedditAward {
|
|
2018
|
+
/** Award ID */
|
|
2019
|
+
id: string | null;
|
|
2020
|
+
/** Award name */
|
|
2021
|
+
name: string;
|
|
2022
|
+
/** Number of this award given */
|
|
2023
|
+
count: number;
|
|
2024
|
+
/** Award icon URL */
|
|
2025
|
+
icon_url: string | null;
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* A Reddit post (link or self post).
|
|
2029
|
+
*/
|
|
2030
|
+
interface RedditPost {
|
|
2031
|
+
/** Unique post identifier (without t3_ prefix) */
|
|
2032
|
+
id: string;
|
|
2033
|
+
/** Fullname with t3_ prefix */
|
|
2034
|
+
fullname: string;
|
|
2035
|
+
/** Post title */
|
|
2036
|
+
title: string;
|
|
2037
|
+
/** Self post text body */
|
|
2038
|
+
selftext: string;
|
|
2039
|
+
/** Self post text as HTML */
|
|
2040
|
+
selftext_html: string | null;
|
|
2041
|
+
/** External or self URL */
|
|
2042
|
+
url: string;
|
|
2043
|
+
/** Permalink to post on Reddit */
|
|
2044
|
+
permalink: string;
|
|
2045
|
+
/** Post domain */
|
|
2046
|
+
domain: string;
|
|
2047
|
+
/** Author username */
|
|
2048
|
+
author: string;
|
|
2049
|
+
/** Author fullname (t2_ prefixed) */
|
|
2050
|
+
author_fullname: string | null;
|
|
2051
|
+
/** Author flair text */
|
|
2052
|
+
author_flair_text: string | null;
|
|
2053
|
+
/** Author flair type (text or richtext) */
|
|
2054
|
+
author_flair_type: string | null;
|
|
2055
|
+
/** Author flair template ID */
|
|
2056
|
+
author_flair_template_id: string | null;
|
|
2057
|
+
/** Subreddit name (without r/ prefix) */
|
|
2058
|
+
subreddit: string;
|
|
2059
|
+
/** Subreddit fullname (t5_ prefixed) */
|
|
2060
|
+
subreddit_id: string | null;
|
|
2061
|
+
/** Subreddit with r/ prefix */
|
|
2062
|
+
subreddit_name_prefixed: string | null;
|
|
2063
|
+
/** Subreddit type (public, private, restricted, etc.) */
|
|
2064
|
+
subreddit_type: string | null;
|
|
2065
|
+
/** Number of subscribers in the subreddit */
|
|
2066
|
+
subreddit_subscribers: number | null;
|
|
2067
|
+
/** Post score (upvotes minus downvotes) */
|
|
2068
|
+
score: number;
|
|
2069
|
+
/** Raw upvotes */
|
|
2070
|
+
ups: number;
|
|
2071
|
+
/** Raw downvotes */
|
|
2072
|
+
downs: number;
|
|
2073
|
+
/** Upvote ratio as a decimal (e.g. 0.95) */
|
|
2074
|
+
upvote_ratio: number | null;
|
|
2075
|
+
/** Number of comments */
|
|
2076
|
+
num_comments: number;
|
|
2077
|
+
/** Number of crossposts */
|
|
2078
|
+
num_crossposts: number;
|
|
2079
|
+
/** Number of duplicate submissions */
|
|
2080
|
+
num_duplicates: number | null;
|
|
2081
|
+
/** View count (null if not available) */
|
|
2082
|
+
view_count: number | null;
|
|
2083
|
+
/** Post creation timestamp (Unix) */
|
|
2084
|
+
created_utc: number;
|
|
2085
|
+
/** Post creation time as ISO 8601 UTC string */
|
|
2086
|
+
created_at: string | null;
|
|
2087
|
+
/** Edited timestamp as float, false if not edited, or null */
|
|
2088
|
+
edited: number | boolean | null;
|
|
2089
|
+
/** Edit time as ISO 8601 UTC string (null if not edited) */
|
|
2090
|
+
edited_at: string | null;
|
|
2091
|
+
/** Whether the post is a self (text) post */
|
|
2092
|
+
is_self: boolean;
|
|
2093
|
+
/** Whether the post is a video */
|
|
2094
|
+
is_video: boolean;
|
|
2095
|
+
/** Whether the post is a gallery */
|
|
2096
|
+
is_gallery: boolean;
|
|
2097
|
+
/** Whether the post is marked NSFW */
|
|
2098
|
+
is_nsfw: boolean;
|
|
2099
|
+
/** Whether the post is marked as a spoiler */
|
|
2100
|
+
is_spoiler: boolean;
|
|
2101
|
+
/** Whether the post is locked */
|
|
2102
|
+
is_locked: boolean;
|
|
2103
|
+
/** Whether the post is stickied */
|
|
2104
|
+
is_stickied: boolean;
|
|
2105
|
+
/** Whether the post is archived */
|
|
2106
|
+
is_archived: boolean;
|
|
2107
|
+
/** Whether the post is pinned */
|
|
2108
|
+
is_pinned: boolean;
|
|
2109
|
+
/** Whether the post is original content */
|
|
2110
|
+
is_original_content: boolean;
|
|
2111
|
+
/** Whether the post is robot-indexable */
|
|
2112
|
+
is_robot_indexable: boolean;
|
|
2113
|
+
/** Whether the post is a meta post */
|
|
2114
|
+
is_meta: boolean;
|
|
2115
|
+
/** Whether the post can be crossposted */
|
|
2116
|
+
is_crosspostable: boolean;
|
|
2117
|
+
/** Whether to send reply notifications */
|
|
2118
|
+
send_replies: boolean;
|
|
2119
|
+
/** Post flair text (null if no flair) */
|
|
2120
|
+
link_flair_text: string | null;
|
|
2121
|
+
/** Post flair background color */
|
|
2122
|
+
link_flair_background_color: string | null;
|
|
2123
|
+
/** Post flair text color */
|
|
2124
|
+
link_flair_text_color: string | null;
|
|
2125
|
+
/** Post flair template ID */
|
|
2126
|
+
link_flair_template_id: string | null;
|
|
2127
|
+
/** Post flair type (text or richtext) */
|
|
2128
|
+
link_flair_type: string | null;
|
|
2129
|
+
/** Post flair CSS class */
|
|
2130
|
+
link_flair_css_class: string | null;
|
|
2131
|
+
/** Distinguished status (moderator, admin, or null) */
|
|
2132
|
+
distinguished: string | null;
|
|
2133
|
+
/** Post thumbnail URL (may be "self", "default", or "nsfw") */
|
|
2134
|
+
thumbnail: string | null;
|
|
2135
|
+
/** Thumbnail width in pixels */
|
|
2136
|
+
thumbnail_width: number | null;
|
|
2137
|
+
/** Thumbnail height in pixels */
|
|
2138
|
+
thumbnail_height: number | null;
|
|
2139
|
+
/** Post hint (image, video, link, self, etc.) */
|
|
2140
|
+
post_hint: string | null;
|
|
2141
|
+
/** Preview images */
|
|
2142
|
+
preview_images: RedditPreviewImage[];
|
|
2143
|
+
/** Embedded media metadata */
|
|
2144
|
+
media: RedditMedia | null;
|
|
2145
|
+
/** Gallery item data */
|
|
2146
|
+
gallery_data: Record<string, unknown>[] | null;
|
|
2147
|
+
/** Parent post fullname if this is a crosspost */
|
|
2148
|
+
crosspost_parent: string | null;
|
|
2149
|
+
/** Suggested sort for comments (null if default) */
|
|
2150
|
+
suggested_sort: string | null;
|
|
2151
|
+
/** Total awards received */
|
|
2152
|
+
total_awards: number;
|
|
2153
|
+
/** Award details */
|
|
2154
|
+
awards: RedditAward[];
|
|
2155
|
+
/** Number of gildings */
|
|
2156
|
+
gilded: number;
|
|
2157
|
+
/** Content categories */
|
|
2158
|
+
content_categories: string[] | null;
|
|
2159
|
+
/** Removal category (null if not removed) */
|
|
2160
|
+
removed_by_category: string | null;
|
|
2161
|
+
/** Treatment tags */
|
|
2162
|
+
treatment_tags: string[];
|
|
2163
|
+
}
|
|
2164
|
+
/**
|
|
2165
|
+
* A Reddit comment.
|
|
2166
|
+
*/
|
|
2167
|
+
interface RedditComment {
|
|
2168
|
+
/** Unique comment identifier (without t1_ prefix) */
|
|
2169
|
+
id: string;
|
|
2170
|
+
/** Fullname with t1_ prefix */
|
|
2171
|
+
fullname: string;
|
|
2172
|
+
/** Comment body text */
|
|
2173
|
+
body: string;
|
|
2174
|
+
/** Comment body as HTML */
|
|
2175
|
+
body_html: string | null;
|
|
2176
|
+
/** Author username */
|
|
2177
|
+
author: string;
|
|
2178
|
+
/** Author fullname (t2_ prefixed) */
|
|
2179
|
+
author_fullname: string | null;
|
|
2180
|
+
/** Author flair text */
|
|
2181
|
+
author_flair_text: string | null;
|
|
2182
|
+
/** Author flair type (text or richtext) */
|
|
2183
|
+
author_flair_type: string | null;
|
|
2184
|
+
/** Subreddit name (without r/ prefix) */
|
|
2185
|
+
subreddit: string;
|
|
2186
|
+
/** Subreddit fullname (t5_ prefixed) */
|
|
2187
|
+
subreddit_id: string | null;
|
|
2188
|
+
/** Subreddit with r/ prefix */
|
|
2189
|
+
subreddit_name_prefixed: string | null;
|
|
2190
|
+
/** Subreddit type (public, private, restricted, etc.) */
|
|
2191
|
+
subreddit_type: string | null;
|
|
2192
|
+
/** Post ID this comment belongs to */
|
|
2193
|
+
post_id: string | null;
|
|
2194
|
+
/** Title of the parent post */
|
|
2195
|
+
post_title: string | null;
|
|
2196
|
+
/** Parent ID (t3_ for top-level, t1_ for reply) */
|
|
2197
|
+
parent_id: string | null;
|
|
2198
|
+
/** Permalink to comment */
|
|
2199
|
+
permalink: string;
|
|
2200
|
+
/** Comment score (upvotes minus downvotes) */
|
|
2201
|
+
score: number;
|
|
2202
|
+
/** Raw upvotes */
|
|
2203
|
+
ups: number;
|
|
2204
|
+
/** Raw downvotes */
|
|
2205
|
+
downs: number;
|
|
2206
|
+
/** Controversiality score */
|
|
2207
|
+
controversiality: number;
|
|
2208
|
+
/** Depth level (0 for top-level comments) */
|
|
2209
|
+
depth: number;
|
|
2210
|
+
/** Comment creation timestamp (Unix) */
|
|
2211
|
+
created_utc: number;
|
|
2212
|
+
/** Comment creation time as ISO 8601 UTC string */
|
|
2213
|
+
created_at: string | null;
|
|
2214
|
+
/** Edited timestamp as float, false if not edited, or null */
|
|
2215
|
+
edited: number | boolean | null;
|
|
2216
|
+
/** Edit time as ISO 8601 UTC string (null if not edited) */
|
|
2217
|
+
edited_at: string | null;
|
|
2218
|
+
/** Whether the author is the post submitter */
|
|
2219
|
+
is_submitter: boolean;
|
|
2220
|
+
/** Whether the comment is stickied */
|
|
2221
|
+
is_stickied: boolean;
|
|
2222
|
+
/** Whether the comment is locked */
|
|
2223
|
+
is_locked: boolean;
|
|
2224
|
+
/** Whether the comment score is hidden */
|
|
2225
|
+
is_score_hidden: boolean;
|
|
2226
|
+
/** Whether to send reply notifications */
|
|
2227
|
+
send_replies: boolean;
|
|
2228
|
+
/** Distinguished status (moderator, admin, or null) */
|
|
2229
|
+
distinguished: string | null;
|
|
2230
|
+
/** Total awards received */
|
|
2231
|
+
total_awards: number;
|
|
2232
|
+
/** Number of gildings */
|
|
2233
|
+
gilded: number;
|
|
2234
|
+
/** Nested replies (empty array if none) */
|
|
2235
|
+
replies: RedditComment[];
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* A Reddit subreddit.
|
|
2239
|
+
*/
|
|
2240
|
+
interface RedditSubreddit {
|
|
2241
|
+
/** Unique subreddit identifier */
|
|
2242
|
+
id: string;
|
|
2243
|
+
/** Fullname with t5_ prefix */
|
|
2244
|
+
fullname: string;
|
|
2245
|
+
/** Subreddit name (without r/ prefix) */
|
|
2246
|
+
name: string;
|
|
2247
|
+
/** Subreddit with r/ prefix */
|
|
2248
|
+
display_name_prefixed: string | null;
|
|
2249
|
+
/** Subreddit title */
|
|
2250
|
+
title: string;
|
|
2251
|
+
/** Full sidebar description (markdown) */
|
|
2252
|
+
description: string;
|
|
2253
|
+
/** Full sidebar description as HTML */
|
|
2254
|
+
description_html: string | null;
|
|
2255
|
+
/** Short public description */
|
|
2256
|
+
public_description: string;
|
|
2257
|
+
/** Short public description as HTML */
|
|
2258
|
+
public_description_html: string | null;
|
|
2259
|
+
/** Text shown when submitting a new post */
|
|
2260
|
+
submit_text: string;
|
|
2261
|
+
/** Submit text as HTML */
|
|
2262
|
+
submit_text_html: string | null;
|
|
2263
|
+
/** Header title text */
|
|
2264
|
+
header_title: string | null;
|
|
2265
|
+
/** Subreddit URL path */
|
|
2266
|
+
url: string;
|
|
2267
|
+
/** Subreddit type (public, private, restricted, etc.) */
|
|
2268
|
+
type: string;
|
|
2269
|
+
/** Allowed submission type (any, link, self) */
|
|
2270
|
+
submission_type: string | null;
|
|
2271
|
+
/** Number of subscribers */
|
|
2272
|
+
subscribers: number;
|
|
2273
|
+
/** Number of users currently online */
|
|
2274
|
+
active_users: number | null;
|
|
2275
|
+
/** Creation timestamp (Unix) */
|
|
2276
|
+
created_utc: number;
|
|
2277
|
+
/** Creation time as ISO 8601 UTC string */
|
|
2278
|
+
created_at: string | null;
|
|
2279
|
+
/** Whether the subreddit is marked NSFW */
|
|
2280
|
+
is_nsfw: boolean;
|
|
2281
|
+
/** Whether the subreddit is quarantined */
|
|
2282
|
+
is_quarantined: boolean;
|
|
2283
|
+
/** Whether the subreddit is advertiser-friendly */
|
|
2284
|
+
is_advertiser_friendly: boolean;
|
|
2285
|
+
/** Advertiser category */
|
|
2286
|
+
advertiser_category: string | null;
|
|
2287
|
+
/** Subreddit language code */
|
|
2288
|
+
language: string | null;
|
|
2289
|
+
/** Subreddit icon URL */
|
|
2290
|
+
icon_url: string | null;
|
|
2291
|
+
/** Header image URL */
|
|
2292
|
+
header_url: string | null;
|
|
2293
|
+
/** Banner image URL */
|
|
2294
|
+
banner_url: string | null;
|
|
2295
|
+
/** Banner background color (hex) */
|
|
2296
|
+
banner_background_color: string | null;
|
|
2297
|
+
/** Primary theme color (hex) */
|
|
2298
|
+
primary_color: string | null;
|
|
2299
|
+
/** Key theme color (hex) */
|
|
2300
|
+
key_color: string | null;
|
|
2301
|
+
/** Whether the wiki is enabled */
|
|
2302
|
+
wiki_enabled: boolean;
|
|
2303
|
+
/** Whether image posts are allowed */
|
|
2304
|
+
allow_images: boolean;
|
|
2305
|
+
/** Whether video posts are allowed */
|
|
2306
|
+
allow_videos: boolean;
|
|
2307
|
+
/** Whether gallery posts are allowed */
|
|
2308
|
+
allow_galleries: boolean;
|
|
2309
|
+
/** Whether polls are allowed */
|
|
2310
|
+
allow_polls: boolean;
|
|
2311
|
+
/** Whether the subreddit appears in discovery feeds */
|
|
2312
|
+
allow_discovery: boolean;
|
|
2313
|
+
/** Whether spoiler tags are enabled */
|
|
2314
|
+
spoilers_enabled: boolean;
|
|
2315
|
+
/** Whether custom emojis are enabled */
|
|
2316
|
+
emojis_enabled: boolean;
|
|
2317
|
+
/** Whether free-form reports are enabled */
|
|
2318
|
+
free_form_reports: boolean;
|
|
2319
|
+
/** Whether the subreddit accepts followers */
|
|
2320
|
+
accept_followers: boolean;
|
|
2321
|
+
/** Whether posting is restricted */
|
|
2322
|
+
restrict_posting: boolean;
|
|
2323
|
+
/** Whether link flairs are enabled */
|
|
2324
|
+
link_flair_enabled: boolean;
|
|
2325
|
+
/** Position of link flair (left, right, or null) */
|
|
2326
|
+
link_flair_position: string | null;
|
|
2327
|
+
/** Whether user flairs are enabled */
|
|
2328
|
+
user_flair_enabled: boolean;
|
|
2329
|
+
/** Position of user flair (left, right, or null) */
|
|
2330
|
+
user_flair_position: string | null;
|
|
2331
|
+
/** Minutes before comment scores are shown */
|
|
2332
|
+
comment_score_hide_mins: number;
|
|
2333
|
+
/** Whether posts are automatically archived */
|
|
2334
|
+
should_archive_posts: boolean;
|
|
2335
|
+
/** Media types allowed in comments */
|
|
2336
|
+
allowed_media_in_comments: string[];
|
|
2337
|
+
}
|
|
2338
|
+
/**
|
|
2339
|
+
* A Reddit user profile.
|
|
2340
|
+
*/
|
|
2341
|
+
interface RedditUser {
|
|
2342
|
+
/** Unique user identifier */
|
|
2343
|
+
id: string;
|
|
2344
|
+
/** Fullname with t2_ prefix */
|
|
2345
|
+
fullname: string | null;
|
|
2346
|
+
/** Username (without u/ prefix) */
|
|
2347
|
+
name: string;
|
|
2348
|
+
/** Username with u/ prefix */
|
|
2349
|
+
display_name_prefixed: string | null;
|
|
2350
|
+
/** Avatar/profile icon URL */
|
|
2351
|
+
icon_url: string | null;
|
|
2352
|
+
/** Snoovatar image URL */
|
|
2353
|
+
snoovatar_url: string | null;
|
|
2354
|
+
/** Profile banner URL */
|
|
2355
|
+
banner_url: string | null;
|
|
2356
|
+
/** Profile title/tagline */
|
|
2357
|
+
profile_title: string | null;
|
|
2358
|
+
/** Profile page URL */
|
|
2359
|
+
profile_url: string | null;
|
|
2360
|
+
/** User description / about text */
|
|
2361
|
+
description: string;
|
|
2362
|
+
/** Post karma */
|
|
2363
|
+
link_karma: number;
|
|
2364
|
+
/** Comment karma */
|
|
2365
|
+
comment_karma: number;
|
|
2366
|
+
/** Karma from received awards */
|
|
2367
|
+
awardee_karma: number;
|
|
2368
|
+
/** Karma from given awards */
|
|
2369
|
+
awarder_karma: number;
|
|
2370
|
+
/** Combined total karma */
|
|
2371
|
+
total_karma: number;
|
|
2372
|
+
/** Account creation timestamp (Unix) */
|
|
2373
|
+
created_utc: number;
|
|
2374
|
+
/** Account creation time as ISO 8601 UTC string */
|
|
2375
|
+
created_at: string | null;
|
|
2376
|
+
/** Whether the account email is verified */
|
|
2377
|
+
has_verified_email: boolean;
|
|
2378
|
+
/** Whether the account is verified */
|
|
2379
|
+
verified: boolean;
|
|
2380
|
+
/** Whether the account accepts followers */
|
|
2381
|
+
accepts_followers: boolean;
|
|
2382
|
+
/** Whether the account has subscribed to Reddit */
|
|
2383
|
+
has_subscribed: boolean;
|
|
2384
|
+
/** Whether the account is a Reddit employee */
|
|
2385
|
+
is_employee: boolean;
|
|
2386
|
+
/** Whether the account is a moderator somewhere */
|
|
2387
|
+
is_mod: boolean;
|
|
2388
|
+
/** Whether the account has Reddit Premium */
|
|
2389
|
+
is_gold: boolean;
|
|
2390
|
+
/** Whether the account is suspended */
|
|
2391
|
+
is_suspended: boolean;
|
|
2392
|
+
/** Whether the profile is NSFW */
|
|
2393
|
+
is_nsfw: boolean;
|
|
2394
|
+
/** Whether the snoovatar is shown in comments */
|
|
2395
|
+
pref_show_snoovatar: boolean;
|
|
2396
|
+
}
|
|
2397
|
+
/**
|
|
2398
|
+
* A subreddit rule.
|
|
2399
|
+
*/
|
|
2400
|
+
interface RedditRule {
|
|
2401
|
+
/** Rule priority order */
|
|
2402
|
+
priority: number;
|
|
2403
|
+
/** Short name / title of the rule */
|
|
2404
|
+
short_name: string;
|
|
2405
|
+
/** Full rule description (markdown) */
|
|
2406
|
+
description: string;
|
|
2407
|
+
/** Full rule description as HTML */
|
|
2408
|
+
description_html: string | null;
|
|
2409
|
+
/** What the rule applies to (link, comment, all) */
|
|
2410
|
+
kind: "link" | "comment" | "all" | string;
|
|
2411
|
+
/** Violation reason label */
|
|
2412
|
+
violation_reason: string | null;
|
|
2413
|
+
}
|
|
2414
|
+
/**
|
|
2415
|
+
* A subreddit wiki page.
|
|
2416
|
+
*/
|
|
2417
|
+
interface RedditWikiPage {
|
|
2418
|
+
/** Wiki page title/slug */
|
|
2419
|
+
title: string;
|
|
2420
|
+
/** Page content (markdown) */
|
|
2421
|
+
content_md: string;
|
|
2422
|
+
/** Page content as HTML */
|
|
2423
|
+
content_html: string | null;
|
|
2424
|
+
/** Author of latest revision */
|
|
2425
|
+
revision_by: string | null;
|
|
2426
|
+
/** Revision timestamp (Unix), null if unknown */
|
|
2427
|
+
revision_date: number | null;
|
|
2428
|
+
}
|
|
2429
|
+
/**
|
|
2430
|
+
* A Reddit user trophy.
|
|
2431
|
+
*/
|
|
2432
|
+
interface RedditTrophy {
|
|
2433
|
+
/** Trophy name */
|
|
2434
|
+
name: string;
|
|
2435
|
+
/** Trophy description */
|
|
2436
|
+
description: string | null;
|
|
2437
|
+
/** Trophy icon URL */
|
|
2438
|
+
icon_url: string | null;
|
|
2439
|
+
/** URL associated with the trophy */
|
|
2440
|
+
url: string | null;
|
|
2441
|
+
}
|
|
2442
|
+
/**
|
|
2443
|
+
* Pagination metadata for list responses.
|
|
2444
|
+
*/
|
|
2445
|
+
interface RedditPagination {
|
|
2446
|
+
/** Cursor for fetching the next page (null if no more pages) */
|
|
2447
|
+
after: string | null;
|
|
2448
|
+
/** Cursor for fetching the previous page (null if on first page) */
|
|
2449
|
+
before: string | null;
|
|
2450
|
+
/** Total number of items fetched so far */
|
|
2451
|
+
count: number;
|
|
2452
|
+
/** Maximum number of items per page */
|
|
2453
|
+
limit: number;
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Response from the post search endpoint.
|
|
2457
|
+
*/
|
|
2458
|
+
interface SearchPostsResponse {
|
|
2459
|
+
/** List of matching posts */
|
|
2460
|
+
posts: RedditPost[];
|
|
2461
|
+
/** Pagination metadata */
|
|
2462
|
+
pagination: RedditPagination;
|
|
2463
|
+
/** Search query string */
|
|
2464
|
+
query: string;
|
|
2465
|
+
/** Sort method used */
|
|
2466
|
+
sort: string;
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* Response from the subreddit posts endpoint.
|
|
2470
|
+
*/
|
|
2471
|
+
interface SubredditPostsResponse {
|
|
2472
|
+
/** List of posts in the subreddit */
|
|
2473
|
+
posts: RedditPost[];
|
|
2474
|
+
/** Pagination metadata */
|
|
2475
|
+
pagination: RedditPagination;
|
|
2476
|
+
/** Subreddit name */
|
|
2477
|
+
subreddit: string;
|
|
2478
|
+
/** Sort method used */
|
|
2479
|
+
sort: string;
|
|
2480
|
+
}
|
|
2481
|
+
/**
|
|
2482
|
+
* Response from the post detail endpoint.
|
|
2483
|
+
*/
|
|
2484
|
+
interface PostDetailResponse {
|
|
2485
|
+
/** Full post details */
|
|
2486
|
+
post: RedditPost;
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Response from the post comments endpoint.
|
|
2490
|
+
*/
|
|
2491
|
+
interface PostCommentsResponse {
|
|
2492
|
+
/** Post details */
|
|
2493
|
+
post: RedditPost;
|
|
2494
|
+
/** Top-level comments with nested replies */
|
|
2495
|
+
comments: RedditComment[];
|
|
2496
|
+
/** Pagination metadata */
|
|
2497
|
+
pagination: RedditPagination;
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Response from the post duplicates endpoint.
|
|
2501
|
+
*/
|
|
2502
|
+
interface PostDuplicatesResponse {
|
|
2503
|
+
/** The original post */
|
|
2504
|
+
original: RedditPost;
|
|
2505
|
+
/** Cross-posts and duplicate submissions */
|
|
2506
|
+
duplicates: RedditPost[];
|
|
2507
|
+
/** Pagination metadata */
|
|
2508
|
+
pagination: RedditPagination;
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Response from the subreddit detail endpoint.
|
|
2512
|
+
*/
|
|
2513
|
+
interface SubredditDetailResponse {
|
|
2514
|
+
/** Full subreddit details */
|
|
2515
|
+
subreddit: RedditSubreddit;
|
|
2516
|
+
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Response from the subreddit rules endpoint.
|
|
2519
|
+
*/
|
|
2520
|
+
interface SubredditRulesResponse {
|
|
2521
|
+
/** List of subreddit rules */
|
|
2522
|
+
rules: RedditRule[];
|
|
2523
|
+
/** Subreddit name */
|
|
2524
|
+
subreddit: string;
|
|
2525
|
+
}
|
|
2526
|
+
/**
|
|
2527
|
+
* Response from the subreddit wiki pages list endpoint.
|
|
2528
|
+
*/
|
|
2529
|
+
interface SubredditWikiPagesResponse {
|
|
2530
|
+
/** List of wiki page slugs */
|
|
2531
|
+
pages: string[];
|
|
2532
|
+
/** Subreddit name */
|
|
2533
|
+
subreddit: string;
|
|
2534
|
+
}
|
|
2535
|
+
/**
|
|
2536
|
+
* Response from the wiki page endpoint.
|
|
2537
|
+
*/
|
|
2538
|
+
interface WikiPageResponse {
|
|
2539
|
+
/** The wiki page content */
|
|
2540
|
+
page: RedditWikiPage;
|
|
2541
|
+
/** Subreddit name */
|
|
2542
|
+
subreddit: string;
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* Response from the user profile endpoint.
|
|
2546
|
+
*/
|
|
2547
|
+
interface UserProfileResponse {
|
|
2548
|
+
/** Full user profile */
|
|
2549
|
+
user: RedditUser;
|
|
2550
|
+
}
|
|
2551
|
+
/**
|
|
2552
|
+
* Response from the user posts endpoint.
|
|
2553
|
+
*/
|
|
2554
|
+
interface UserPostsResponse {
|
|
2555
|
+
/** List of user's posts */
|
|
2556
|
+
posts: RedditPost[];
|
|
2557
|
+
/** Pagination metadata */
|
|
2558
|
+
pagination: RedditPagination;
|
|
2559
|
+
/** Username */
|
|
2560
|
+
username: string;
|
|
2561
|
+
}
|
|
2562
|
+
/**
|
|
2563
|
+
* Response from the user comments endpoint.
|
|
2564
|
+
*/
|
|
2565
|
+
interface UserCommentsResponse {
|
|
2566
|
+
/** List of user's comments */
|
|
2567
|
+
comments: RedditComment[];
|
|
2568
|
+
/** Pagination metadata */
|
|
2569
|
+
pagination: RedditPagination;
|
|
2570
|
+
/** Username */
|
|
2571
|
+
username: string;
|
|
2572
|
+
}
|
|
2573
|
+
/**
|
|
2574
|
+
* Response from the user moderated subreddits endpoint.
|
|
2575
|
+
*/
|
|
2576
|
+
interface UserModeratedResponse {
|
|
2577
|
+
/** Subreddits moderated by the user */
|
|
2578
|
+
subreddits: RedditSubreddit[];
|
|
2579
|
+
/** Username */
|
|
2580
|
+
username: string;
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Response from the user trophies endpoint.
|
|
2584
|
+
*/
|
|
2585
|
+
interface UserTrophiesResponse {
|
|
2586
|
+
/** List of trophies awarded to the user */
|
|
2587
|
+
trophies: RedditTrophy[];
|
|
2588
|
+
/** Username */
|
|
2589
|
+
username: string;
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Response from the subreddit search endpoint.
|
|
2593
|
+
*/
|
|
2594
|
+
interface SearchSubredditsResponse {
|
|
2595
|
+
/** List of matching subreddits */
|
|
2596
|
+
subreddits: RedditSubreddit[];
|
|
2597
|
+
/** Pagination metadata */
|
|
2598
|
+
pagination: RedditPagination;
|
|
2599
|
+
/** Search query string */
|
|
2600
|
+
query: string;
|
|
2601
|
+
}
|
|
2602
|
+
/**
|
|
2603
|
+
* Response from the user search endpoint.
|
|
2604
|
+
*/
|
|
2605
|
+
interface SearchUsersResponse {
|
|
2606
|
+
/** List of matching users */
|
|
2607
|
+
users: RedditUser[];
|
|
2608
|
+
/** Pagination metadata */
|
|
2609
|
+
pagination: RedditPagination;
|
|
2610
|
+
/** Search query string */
|
|
2611
|
+
query: string;
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* Response from the trending posts endpoint.
|
|
2615
|
+
*/
|
|
2616
|
+
interface TrendingPostsResponse {
|
|
2617
|
+
/** List of trending posts */
|
|
2618
|
+
posts: RedditPost[];
|
|
2619
|
+
/** Pagination metadata */
|
|
2620
|
+
pagination: RedditPagination;
|
|
2621
|
+
/** Sort method used */
|
|
2622
|
+
sort: string;
|
|
2623
|
+
}
|
|
2624
|
+
/**
|
|
2625
|
+
* Response from the popular subreddits endpoint.
|
|
2626
|
+
*/
|
|
2627
|
+
interface PopularSubredditsResponse {
|
|
2628
|
+
/** List of popular subreddits */
|
|
2629
|
+
subreddits: RedditSubreddit[];
|
|
2630
|
+
/** Pagination metadata */
|
|
2631
|
+
pagination: RedditPagination;
|
|
2632
|
+
}
|
|
2633
|
+
/**
|
|
2634
|
+
* Response from the domain posts endpoint.
|
|
2635
|
+
*/
|
|
2636
|
+
interface DomainPostsResponse {
|
|
2637
|
+
/** List of posts linking to the domain */
|
|
2638
|
+
posts: RedditPost[];
|
|
2639
|
+
/** Pagination metadata */
|
|
2640
|
+
pagination: RedditPagination;
|
|
2641
|
+
/** Domain name */
|
|
2642
|
+
domain: string;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
/**
|
|
2646
|
+
* Reddit Search API client.
|
|
2647
|
+
*
|
|
2648
|
+
* Provides methods for searching Reddit posts, subreddits, users, and domain posts.
|
|
2649
|
+
*/
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Client for Reddit search endpoints.
|
|
2653
|
+
*
|
|
2654
|
+
* @example
|
|
2655
|
+
* ```typescript
|
|
2656
|
+
* const client = new ScrapeBadger({ apiKey: "key" });
|
|
2657
|
+
*
|
|
2658
|
+
* // Search posts
|
|
2659
|
+
* const results = await client.reddit.search.posts({ query: "typescript tips" });
|
|
2660
|
+
* for (const post of results.posts) {
|
|
2661
|
+
* console.log(`${post.title} — ${post.score} points`);
|
|
2662
|
+
* }
|
|
2663
|
+
*
|
|
2664
|
+
* // Search subreddits
|
|
2665
|
+
* const subs = await client.reddit.search.subreddits({ query: "programming" });
|
|
2666
|
+
*
|
|
2667
|
+
* // Get posts from a domain
|
|
2668
|
+
* const domainPosts = await client.reddit.search.domainPosts({ domain: "github.com" });
|
|
2669
|
+
* ```
|
|
2670
|
+
*/
|
|
2671
|
+
declare class SearchClient {
|
|
2672
|
+
private readonly client;
|
|
2673
|
+
constructor(client: BaseClient);
|
|
2674
|
+
/**
|
|
2675
|
+
* Search Reddit posts.
|
|
2676
|
+
*
|
|
2677
|
+
* @param options - Search parameters.
|
|
2678
|
+
* @param options.query - Search query string.
|
|
2679
|
+
* @param options.subreddit - Restrict search to a specific subreddit.
|
|
2680
|
+
* @param options.sort - Sort order (relevance, hot, top, new, comments).
|
|
2681
|
+
* @param options.time - Time filter (hour, day, week, month, year, all).
|
|
2682
|
+
* @param options.after - Pagination cursor for the next page.
|
|
2683
|
+
* @param options.limit - Number of results to return (max 100).
|
|
2684
|
+
* @returns Search results with posts and pagination metadata.
|
|
2685
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2686
|
+
* @throws ValidationError - If the search parameters are invalid.
|
|
2687
|
+
*
|
|
2688
|
+
* @example
|
|
2689
|
+
* ```typescript
|
|
2690
|
+
* const results = await client.reddit.search.posts({
|
|
2691
|
+
* query: "best practices",
|
|
2692
|
+
* subreddit: "programming",
|
|
2693
|
+
* sort: "top",
|
|
2694
|
+
* time: "month",
|
|
2695
|
+
* limit: 25,
|
|
2696
|
+
* });
|
|
2697
|
+
* console.log(`Found ${results.posts.length} posts`);
|
|
2698
|
+
* ```
|
|
2699
|
+
*/
|
|
2700
|
+
posts(options: {
|
|
2701
|
+
query: string;
|
|
2702
|
+
subreddit?: string;
|
|
2703
|
+
sort?: "relevance" | "hot" | "top" | "new" | "comments";
|
|
2704
|
+
time?: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
2705
|
+
after?: string;
|
|
2706
|
+
limit?: number;
|
|
2707
|
+
}): Promise<SearchPostsResponse>;
|
|
2708
|
+
/**
|
|
2709
|
+
* Search Reddit subreddits.
|
|
2710
|
+
*
|
|
2711
|
+
* @param options - Search parameters.
|
|
2712
|
+
* @param options.query - Search query string.
|
|
2713
|
+
* @param options.after - Pagination cursor for the next page.
|
|
2714
|
+
* @param options.limit - Number of results to return (max 100).
|
|
2715
|
+
* @returns Matching subreddits with pagination metadata.
|
|
2716
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2717
|
+
* @throws ValidationError - If the search parameters are invalid.
|
|
2718
|
+
*
|
|
2719
|
+
* @example
|
|
2720
|
+
* ```typescript
|
|
2721
|
+
* const results = await client.reddit.search.subreddits({
|
|
2722
|
+
* query: "javascript",
|
|
2723
|
+
* limit: 10,
|
|
2724
|
+
* });
|
|
2725
|
+
* for (const sub of results.subreddits) {
|
|
2726
|
+
* console.log(`r/${sub.display_name}: ${sub.subscribers.toLocaleString()} subscribers`);
|
|
2727
|
+
* }
|
|
2728
|
+
* ```
|
|
2729
|
+
*/
|
|
2730
|
+
subreddits(options: {
|
|
2731
|
+
query: string;
|
|
2732
|
+
after?: string;
|
|
2733
|
+
limit?: number;
|
|
2734
|
+
}): Promise<SearchSubredditsResponse>;
|
|
2735
|
+
/**
|
|
2736
|
+
* Search Reddit users.
|
|
2737
|
+
*
|
|
2738
|
+
* @param options - Search parameters.
|
|
2739
|
+
* @param options.query - Search query string.
|
|
2740
|
+
* @param options.after - Pagination cursor for the next page.
|
|
2741
|
+
* @param options.limit - Number of results to return (max 100).
|
|
2742
|
+
* @returns Matching users with pagination metadata.
|
|
2743
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2744
|
+
* @throws ValidationError - If the search parameters are invalid.
|
|
2745
|
+
*
|
|
2746
|
+
* @example
|
|
2747
|
+
* ```typescript
|
|
2748
|
+
* const results = await client.reddit.search.users({
|
|
2749
|
+
* query: "john",
|
|
2750
|
+
* limit: 20,
|
|
2751
|
+
* });
|
|
2752
|
+
* for (const user of results.users) {
|
|
2753
|
+
* console.log(`u/${user.name}: ${user.total_karma.toLocaleString()} karma`);
|
|
2754
|
+
* }
|
|
2755
|
+
* ```
|
|
2756
|
+
*/
|
|
2757
|
+
users(options: {
|
|
2758
|
+
query: string;
|
|
2759
|
+
after?: string;
|
|
2760
|
+
limit?: number;
|
|
2761
|
+
}): Promise<SearchUsersResponse>;
|
|
2762
|
+
/**
|
|
2763
|
+
* Get Reddit posts linking to a specific domain.
|
|
2764
|
+
*
|
|
2765
|
+
* @param options - Request parameters.
|
|
2766
|
+
* @param options.domain - Domain name to search for (e.g. "github.com").
|
|
2767
|
+
* @param options.sort - Sort order (hot, new, top, rising).
|
|
2768
|
+
* @param options.time - Time filter for top sort (hour, day, week, month, year, all).
|
|
2769
|
+
* @param options.after - Pagination cursor for the next page.
|
|
2770
|
+
* @param options.limit - Number of results to return (max 100).
|
|
2771
|
+
* @returns Posts linking to the domain with pagination metadata.
|
|
2772
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2773
|
+
* @throws ValidationError - If the parameters are invalid.
|
|
2774
|
+
*
|
|
2775
|
+
* @example
|
|
2776
|
+
* ```typescript
|
|
2777
|
+
* const results = await client.reddit.search.domainPosts({
|
|
2778
|
+
* domain: "github.com",
|
|
2779
|
+
* sort: "top",
|
|
2780
|
+
* time: "week",
|
|
2781
|
+
* limit: 25,
|
|
2782
|
+
* });
|
|
2783
|
+
* for (const post of results.posts) {
|
|
2784
|
+
* console.log(`r/${post.subreddit}: ${post.title}`);
|
|
2785
|
+
* }
|
|
2786
|
+
* ```
|
|
2787
|
+
*/
|
|
2788
|
+
domainPosts(options: {
|
|
2789
|
+
domain: string;
|
|
2790
|
+
sort?: "hot" | "new" | "top" | "rising";
|
|
2791
|
+
time?: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
2792
|
+
after?: string;
|
|
2793
|
+
limit?: number;
|
|
2794
|
+
}): Promise<DomainPostsResponse>;
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2797
|
+
/**
|
|
2798
|
+
* Reddit Posts API client.
|
|
2799
|
+
*
|
|
2800
|
+
* Provides methods for fetching trending posts, post details, comments, and duplicates.
|
|
2801
|
+
*/
|
|
2802
|
+
|
|
2803
|
+
/**
|
|
2804
|
+
* Client for Reddit post endpoints.
|
|
2805
|
+
*
|
|
2806
|
+
* @example
|
|
2807
|
+
* ```typescript
|
|
2808
|
+
* const client = new ScrapeBadger({ apiKey: "key" });
|
|
2809
|
+
*
|
|
2810
|
+
* // Get trending posts
|
|
2811
|
+
* const trending = await client.reddit.posts.trending({ subreddit: "programming" });
|
|
2812
|
+
*
|
|
2813
|
+
* // Get post details
|
|
2814
|
+
* const post = await client.reddit.posts.get("t3_abc123");
|
|
2815
|
+
*
|
|
2816
|
+
* // Get post comments
|
|
2817
|
+
* const { comments } = await client.reddit.posts.comments("abc123", { subreddit: "programming" });
|
|
2818
|
+
* ```
|
|
2819
|
+
*/
|
|
2820
|
+
declare class PostsClient {
|
|
2821
|
+
private readonly client;
|
|
2822
|
+
constructor(client: BaseClient);
|
|
2823
|
+
/**
|
|
2824
|
+
* Get trending/hot posts from Reddit or a specific subreddit.
|
|
2825
|
+
*
|
|
2826
|
+
* @param options - Request parameters.
|
|
2827
|
+
* @param options.subreddit - Subreddit name (without r/). If omitted, returns site-wide posts.
|
|
2828
|
+
* @param options.sort - Sort order (hot, new, top, rising, controversial).
|
|
2829
|
+
* @param options.time - Time filter for top/controversial (hour, day, week, month, year, all).
|
|
2830
|
+
* @param options.after - Pagination cursor for the next page.
|
|
2831
|
+
* @param options.limit - Number of results to return (max 100).
|
|
2832
|
+
* @returns Trending posts with pagination metadata.
|
|
2833
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2834
|
+
*
|
|
2835
|
+
* @example
|
|
2836
|
+
* ```typescript
|
|
2837
|
+
* const results = await client.reddit.posts.trending({
|
|
2838
|
+
* subreddit: "worldnews",
|
|
2839
|
+
* sort: "hot",
|
|
2840
|
+
* limit: 25,
|
|
2841
|
+
* });
|
|
2842
|
+
* for (const post of results.posts) {
|
|
2843
|
+
* console.log(`${post.title} (${post.num_comments} comments)`);
|
|
2844
|
+
* }
|
|
2845
|
+
* ```
|
|
2846
|
+
*/
|
|
2847
|
+
trending(options?: {
|
|
2848
|
+
subreddit?: string;
|
|
2849
|
+
sort?: "hot" | "new" | "top" | "rising" | "controversial";
|
|
2850
|
+
time?: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
2851
|
+
after?: string;
|
|
2852
|
+
limit?: number;
|
|
2853
|
+
}): Promise<TrendingPostsResponse>;
|
|
2854
|
+
/**
|
|
2855
|
+
* Get full details of a single Reddit post.
|
|
2856
|
+
*
|
|
2857
|
+
* @param postId - The Reddit post ID (e.g. "abc123" or "t3_abc123").
|
|
2858
|
+
* @param options - Optional parameters.
|
|
2859
|
+
* @param options.subreddit - Subreddit name (helps resolve the post URL).
|
|
2860
|
+
* @returns Full post details.
|
|
2861
|
+
* @throws NotFoundError - If the post doesn't exist.
|
|
2862
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2863
|
+
*
|
|
2864
|
+
* @example
|
|
2865
|
+
* ```typescript
|
|
2866
|
+
* const response = await client.reddit.posts.get("abc123", { subreddit: "programming" });
|
|
2867
|
+
* const { post } = response;
|
|
2868
|
+
* console.log(`${post.title} by u/${post.author}`);
|
|
2869
|
+
* console.log(`Score: ${post.score}, Comments: ${post.num_comments}`);
|
|
2870
|
+
* ```
|
|
2871
|
+
*/
|
|
2872
|
+
get(postId: string, options?: {
|
|
2873
|
+
subreddit?: string;
|
|
2874
|
+
}): Promise<PostDetailResponse>;
|
|
2875
|
+
/**
|
|
2876
|
+
* Get comments for a Reddit post.
|
|
2877
|
+
*
|
|
2878
|
+
* @param postId - The Reddit post ID (e.g. "abc123" or "t3_abc123").
|
|
2879
|
+
* @param options - Optional parameters.
|
|
2880
|
+
* @param options.subreddit - Subreddit name (helps resolve the post URL).
|
|
2881
|
+
* @param options.sort - Comment sort order (confidence, top, new, controversial, old, qa).
|
|
2882
|
+
* @param options.depth - Maximum comment tree depth.
|
|
2883
|
+
* @param options.limit - Number of top-level comments to return.
|
|
2884
|
+
* @returns Post details and nested comment tree.
|
|
2885
|
+
* @throws NotFoundError - If the post doesn't exist.
|
|
2886
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2887
|
+
*
|
|
2888
|
+
* @example
|
|
2889
|
+
* ```typescript
|
|
2890
|
+
* const response = await client.reddit.posts.comments("abc123", {
|
|
2891
|
+
* subreddit: "programming",
|
|
2892
|
+
* sort: "top",
|
|
2893
|
+
* limit: 50,
|
|
2894
|
+
* });
|
|
2895
|
+
* for (const comment of response.comments) {
|
|
2896
|
+
* console.log(`u/${comment.author}: ${comment.body.slice(0, 100)}`);
|
|
2897
|
+
* }
|
|
2898
|
+
* ```
|
|
2899
|
+
*/
|
|
2900
|
+
comments(postId: string, options?: {
|
|
2901
|
+
subreddit?: string;
|
|
2902
|
+
sort?: "confidence" | "top" | "new" | "controversial" | "old" | "qa";
|
|
2903
|
+
depth?: number;
|
|
2904
|
+
limit?: number;
|
|
2905
|
+
}): Promise<PostCommentsResponse>;
|
|
2906
|
+
/**
|
|
2907
|
+
* Get cross-posts and duplicate submissions of a Reddit post.
|
|
2908
|
+
*
|
|
2909
|
+
* @param postId - The Reddit post ID (e.g. "abc123" or "t3_abc123").
|
|
2910
|
+
* @param options - Optional parameters.
|
|
2911
|
+
* @param options.after - Pagination cursor for the next page.
|
|
2912
|
+
* @param options.limit - Number of results to return (max 100).
|
|
2913
|
+
* @returns The original post and its duplicate submissions.
|
|
2914
|
+
* @throws NotFoundError - If the post doesn't exist.
|
|
2915
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2916
|
+
*
|
|
2917
|
+
* @example
|
|
2918
|
+
* ```typescript
|
|
2919
|
+
* const response = await client.reddit.posts.duplicates("abc123");
|
|
2920
|
+
* console.log(`Original: ${response.post.title}`);
|
|
2921
|
+
* console.log(`Cross-posted ${response.duplicates.length} times`);
|
|
2922
|
+
* for (const dupe of response.duplicates) {
|
|
2923
|
+
* console.log(` r/${dupe.subreddit}: ${dupe.score} points`);
|
|
2924
|
+
* }
|
|
2925
|
+
* ```
|
|
2926
|
+
*/
|
|
2927
|
+
duplicates(postId: string, options?: {
|
|
2928
|
+
after?: string;
|
|
2929
|
+
limit?: number;
|
|
2930
|
+
}): Promise<PostDuplicatesResponse>;
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
/**
|
|
2934
|
+
* Reddit Subreddits API client.
|
|
2935
|
+
*
|
|
2936
|
+
* Provides methods for fetching subreddit details, posts, rules, and wiki pages.
|
|
2937
|
+
*/
|
|
2938
|
+
|
|
2939
|
+
/**
|
|
2940
|
+
* Client for Reddit subreddit endpoints.
|
|
2941
|
+
*
|
|
2942
|
+
* @example
|
|
2943
|
+
* ```typescript
|
|
2944
|
+
* const client = new ScrapeBadger({ apiKey: "key" });
|
|
2945
|
+
*
|
|
2946
|
+
* // Get subreddit details
|
|
2947
|
+
* const sub = await client.reddit.subreddits.get("programming");
|
|
2948
|
+
* console.log(`r/programming: ${sub.subreddit.subscribers.toLocaleString()} subscribers`);
|
|
2949
|
+
*
|
|
2950
|
+
* // Get subreddit posts
|
|
2951
|
+
* const posts = await client.reddit.subreddits.posts("programming", { sort: "top" });
|
|
2952
|
+
*
|
|
2953
|
+
* // Get subreddit rules
|
|
2954
|
+
* const rules = await client.reddit.subreddits.rules("programming");
|
|
2955
|
+
* ```
|
|
2956
|
+
*/
|
|
2957
|
+
declare class SubredditsClient {
|
|
2958
|
+
private readonly client;
|
|
2959
|
+
constructor(client: BaseClient);
|
|
2960
|
+
/**
|
|
2961
|
+
* Get a subreddit's full details and metadata.
|
|
2962
|
+
*
|
|
2963
|
+
* @param subreddit - Subreddit name (without r/ prefix).
|
|
2964
|
+
* @returns Full subreddit details.
|
|
2965
|
+
* @throws NotFoundError - If the subreddit doesn't exist.
|
|
2966
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2967
|
+
*
|
|
2968
|
+
* @example
|
|
2969
|
+
* ```typescript
|
|
2970
|
+
* const response = await client.reddit.subreddits.get("javascript");
|
|
2971
|
+
* const { subreddit } = response;
|
|
2972
|
+
* console.log(`${subreddit.title}: ${subreddit.subscribers.toLocaleString()} members`);
|
|
2973
|
+
* console.log(`Description: ${subreddit.public_description}`);
|
|
2974
|
+
* ```
|
|
2975
|
+
*/
|
|
2976
|
+
get(subreddit: string): Promise<SubredditDetailResponse>;
|
|
2977
|
+
/**
|
|
2978
|
+
* Get posts from a subreddit.
|
|
2979
|
+
*
|
|
2980
|
+
* @param subreddit - Subreddit name (without r/ prefix).
|
|
2981
|
+
* @param options - Optional parameters.
|
|
2982
|
+
* @param options.sort - Sort order (hot, new, top, rising, controversial).
|
|
2983
|
+
* @param options.time - Time filter for top/controversial (hour, day, week, month, year, all).
|
|
2984
|
+
* @param options.after - Pagination cursor for the next page.
|
|
2985
|
+
* @param options.limit - Number of results to return (max 100).
|
|
2986
|
+
* @returns Subreddit posts with pagination metadata.
|
|
2987
|
+
* @throws NotFoundError - If the subreddit doesn't exist.
|
|
2988
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2989
|
+
*
|
|
2990
|
+
* @example
|
|
2991
|
+
* ```typescript
|
|
2992
|
+
* const response = await client.reddit.subreddits.posts("typescript", {
|
|
2993
|
+
* sort: "top",
|
|
2994
|
+
* time: "week",
|
|
2995
|
+
* limit: 25,
|
|
2996
|
+
* });
|
|
2997
|
+
* for (const post of response.posts) {
|
|
2998
|
+
* console.log(`${post.title} — ${post.score} pts`);
|
|
2999
|
+
* }
|
|
3000
|
+
* ```
|
|
3001
|
+
*/
|
|
3002
|
+
posts(subreddit: string, options?: {
|
|
3003
|
+
sort?: "hot" | "new" | "top" | "rising" | "controversial";
|
|
3004
|
+
time?: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
3005
|
+
after?: string;
|
|
3006
|
+
limit?: number;
|
|
3007
|
+
}): Promise<SubredditPostsResponse>;
|
|
3008
|
+
/**
|
|
3009
|
+
* Get the rules for a subreddit.
|
|
3010
|
+
*
|
|
3011
|
+
* @param subreddit - Subreddit name (without r/ prefix).
|
|
3012
|
+
* @returns List of subreddit rules.
|
|
3013
|
+
* @throws NotFoundError - If the subreddit doesn't exist.
|
|
3014
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3015
|
+
*
|
|
3016
|
+
* @example
|
|
3017
|
+
* ```typescript
|
|
3018
|
+
* const response = await client.reddit.subreddits.rules("AskReddit");
|
|
3019
|
+
* for (const rule of response.rules) {
|
|
3020
|
+
* console.log(`${rule.priority}. ${rule.short_name}`);
|
|
3021
|
+
* console.log(` ${rule.description}`);
|
|
3022
|
+
* }
|
|
3023
|
+
* ```
|
|
3024
|
+
*/
|
|
3025
|
+
rules(subreddit: string): Promise<SubredditRulesResponse>;
|
|
3026
|
+
/**
|
|
3027
|
+
* List all wiki pages in a subreddit.
|
|
3028
|
+
*
|
|
3029
|
+
* @param subreddit - Subreddit name (without r/ prefix).
|
|
3030
|
+
* @returns List of wiki page slugs.
|
|
3031
|
+
* @throws NotFoundError - If the subreddit doesn't exist.
|
|
3032
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3033
|
+
*
|
|
3034
|
+
* @example
|
|
3035
|
+
* ```typescript
|
|
3036
|
+
* const response = await client.reddit.subreddits.wikiPages("rust");
|
|
3037
|
+
* for (const page of response.pages) {
|
|
3038
|
+
* console.log(`/r/rust/wiki/${page}`);
|
|
3039
|
+
* }
|
|
3040
|
+
* ```
|
|
3041
|
+
*/
|
|
3042
|
+
wikiPages(subreddit: string): Promise<SubredditWikiPagesResponse>;
|
|
3043
|
+
/**
|
|
3044
|
+
* Get the content of a specific wiki page in a subreddit.
|
|
3045
|
+
*
|
|
3046
|
+
* @param subreddit - Subreddit name (without r/ prefix).
|
|
3047
|
+
* @param page - Wiki page slug (e.g. "index", "faq").
|
|
3048
|
+
* @returns Wiki page content and metadata.
|
|
3049
|
+
* @throws NotFoundError - If the subreddit or wiki page doesn't exist.
|
|
3050
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3051
|
+
*
|
|
3052
|
+
* @example
|
|
3053
|
+
* ```typescript
|
|
3054
|
+
* const response = await client.reddit.subreddits.wikiPage("learnprogramming", "faq");
|
|
3055
|
+
* console.log(`Last edited by: u/${response.page.revision_by}`);
|
|
3056
|
+
* console.log(response.page.content_md);
|
|
3057
|
+
* ```
|
|
3058
|
+
*/
|
|
3059
|
+
wikiPage(subreddit: string, page: string): Promise<WikiPageResponse>;
|
|
3060
|
+
/**
|
|
3061
|
+
* Get the most popular subreddits on Reddit.
|
|
3062
|
+
*
|
|
3063
|
+
* @param options - Optional parameters.
|
|
3064
|
+
* @param options.after - Pagination cursor for the next page.
|
|
3065
|
+
* @param options.limit - Number of results to return (max 100).
|
|
3066
|
+
* @returns Popular subreddits with pagination metadata.
|
|
3067
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3068
|
+
*
|
|
3069
|
+
* @example
|
|
3070
|
+
* ```typescript
|
|
3071
|
+
* const response = await client.reddit.subreddits.popular({ limit: 20 });
|
|
3072
|
+
* for (const sub of response.subreddits) {
|
|
3073
|
+
* console.log(`r/${sub.display_name}: ${sub.subscribers.toLocaleString()} subscribers`);
|
|
3074
|
+
* }
|
|
3075
|
+
* ```
|
|
3076
|
+
*/
|
|
3077
|
+
popular(options?: {
|
|
3078
|
+
after?: string;
|
|
3079
|
+
limit?: number;
|
|
3080
|
+
}): Promise<PopularSubredditsResponse>;
|
|
3081
|
+
/**
|
|
3082
|
+
* Get newly created subreddits on Reddit.
|
|
3083
|
+
*
|
|
3084
|
+
* @param options - Optional parameters.
|
|
3085
|
+
* @param options.after - Pagination cursor for the next page.
|
|
3086
|
+
* @param options.limit - Number of results to return (max 100).
|
|
3087
|
+
* @returns New subreddits with pagination metadata.
|
|
3088
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3089
|
+
*
|
|
3090
|
+
* @example
|
|
3091
|
+
* ```typescript
|
|
3092
|
+
* const response = await client.reddit.subreddits.newSubreddits({ limit: 20 });
|
|
3093
|
+
* for (const sub of response.subreddits) {
|
|
3094
|
+
* console.log(`r/${sub.display_name} (created: ${new Date(sub.created_utc * 1000).toLocaleDateString()})`);
|
|
3095
|
+
* }
|
|
3096
|
+
* ```
|
|
3097
|
+
*/
|
|
3098
|
+
newSubreddits(options?: {
|
|
3099
|
+
after?: string;
|
|
3100
|
+
limit?: number;
|
|
3101
|
+
}): Promise<PopularSubredditsResponse>;
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
/**
|
|
3105
|
+
* Reddit Users API client.
|
|
3106
|
+
*
|
|
3107
|
+
* Provides methods for fetching Reddit user profiles, posts, comments, moderated subreddits, and trophies.
|
|
3108
|
+
*/
|
|
3109
|
+
|
|
3110
|
+
/**
|
|
3111
|
+
* Client for Reddit user endpoints.
|
|
3112
|
+
*
|
|
3113
|
+
* @example
|
|
3114
|
+
* ```typescript
|
|
3115
|
+
* const client = new ScrapeBadger({ apiKey: "key" });
|
|
3116
|
+
*
|
|
3117
|
+
* // Get user profile
|
|
3118
|
+
* const profile = await client.reddit.users.get("spez");
|
|
3119
|
+
* console.log(`u/${profile.user.name}: ${profile.user.total_karma.toLocaleString()} karma`);
|
|
3120
|
+
*
|
|
3121
|
+
* // Get user's recent posts
|
|
3122
|
+
* const posts = await client.reddit.users.posts("spez", { sort: "top", limit: 10 });
|
|
3123
|
+
*
|
|
3124
|
+
* // Get user's comments
|
|
3125
|
+
* const comments = await client.reddit.users.comments("spez", { sort: "new" });
|
|
3126
|
+
* ```
|
|
3127
|
+
*/
|
|
3128
|
+
declare class UsersClient {
|
|
3129
|
+
private readonly client;
|
|
3130
|
+
constructor(client: BaseClient);
|
|
3131
|
+
/**
|
|
3132
|
+
* Get a Reddit user's profile.
|
|
3133
|
+
*
|
|
3134
|
+
* @param username - The Reddit username (without u/ prefix).
|
|
3135
|
+
* @returns The user profile response.
|
|
3136
|
+
* @throws NotFoundError - If the user doesn't exist or is suspended.
|
|
3137
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3138
|
+
*
|
|
3139
|
+
* @example
|
|
3140
|
+
* ```typescript
|
|
3141
|
+
* const response = await client.reddit.users.get("spez");
|
|
3142
|
+
* const { user } = response;
|
|
3143
|
+
* console.log(`u/${user.name}`);
|
|
3144
|
+
* console.log(`Karma: ${user.total_karma.toLocaleString()} (${user.link_karma} post, ${user.comment_karma} comment)`);
|
|
3145
|
+
* console.log(`Account age: ${new Date(user.created_utc * 1000).toLocaleDateString()}`);
|
|
3146
|
+
* ```
|
|
3147
|
+
*/
|
|
3148
|
+
get(username: string): Promise<UserProfileResponse>;
|
|
3149
|
+
/**
|
|
3150
|
+
* Get posts submitted by a Reddit user.
|
|
3151
|
+
*
|
|
3152
|
+
* @param username - The Reddit username (without u/ prefix).
|
|
3153
|
+
* @param options - Optional parameters.
|
|
3154
|
+
* @param options.sort - Sort order (hot, new, top, controversial).
|
|
3155
|
+
* @param options.time - Time filter for top/controversial (hour, day, week, month, year, all).
|
|
3156
|
+
* @param options.after - Pagination cursor for the next page.
|
|
3157
|
+
* @param options.limit - Number of results to return (max 100).
|
|
3158
|
+
* @returns The user's posts with pagination metadata.
|
|
3159
|
+
* @throws NotFoundError - If the user doesn't exist.
|
|
3160
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3161
|
+
*
|
|
3162
|
+
* @example
|
|
3163
|
+
* ```typescript
|
|
3164
|
+
* const response = await client.reddit.users.posts("spez", {
|
|
3165
|
+
* sort: "top",
|
|
3166
|
+
* time: "all",
|
|
3167
|
+
* limit: 25,
|
|
3168
|
+
* });
|
|
3169
|
+
* for (const post of response.posts) {
|
|
3170
|
+
* console.log(`r/${post.subreddit}: ${post.title} (${post.score} pts)`);
|
|
3171
|
+
* }
|
|
3172
|
+
* ```
|
|
3173
|
+
*/
|
|
3174
|
+
posts(username: string, options?: {
|
|
3175
|
+
sort?: "hot" | "new" | "top" | "controversial";
|
|
3176
|
+
time?: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
3177
|
+
after?: string;
|
|
3178
|
+
limit?: number;
|
|
3179
|
+
}): Promise<UserPostsResponse>;
|
|
3180
|
+
/**
|
|
3181
|
+
* Get comments made by a Reddit user.
|
|
3182
|
+
*
|
|
3183
|
+
* @param username - The Reddit username (without u/ prefix).
|
|
3184
|
+
* @param options - Optional parameters.
|
|
3185
|
+
* @param options.sort - Sort order (hot, new, top, controversial).
|
|
3186
|
+
* @param options.time - Time filter for top/controversial (hour, day, week, month, year, all).
|
|
3187
|
+
* @param options.after - Pagination cursor for the next page.
|
|
3188
|
+
* @param options.limit - Number of results to return (max 100).
|
|
3189
|
+
* @returns The user's comments with pagination metadata.
|
|
3190
|
+
* @throws NotFoundError - If the user doesn't exist.
|
|
3191
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3192
|
+
*
|
|
3193
|
+
* @example
|
|
3194
|
+
* ```typescript
|
|
3195
|
+
* const response = await client.reddit.users.comments("spez", {
|
|
3196
|
+
* sort: "new",
|
|
3197
|
+
* limit: 50,
|
|
3198
|
+
* });
|
|
3199
|
+
* for (const comment of response.comments) {
|
|
3200
|
+
* console.log(`r/${comment.subreddit}: ${comment.body.slice(0, 80)}`);
|
|
3201
|
+
* }
|
|
3202
|
+
* ```
|
|
3203
|
+
*/
|
|
3204
|
+
comments(username: string, options?: {
|
|
3205
|
+
sort?: "hot" | "new" | "top" | "controversial";
|
|
3206
|
+
time?: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
3207
|
+
after?: string;
|
|
3208
|
+
limit?: number;
|
|
3209
|
+
}): Promise<UserCommentsResponse>;
|
|
3210
|
+
/**
|
|
3211
|
+
* Get subreddits moderated by a Reddit user.
|
|
3212
|
+
*
|
|
3213
|
+
* @param username - The Reddit username (without u/ prefix).
|
|
3214
|
+
* @returns Subreddits moderated by the user.
|
|
3215
|
+
* @throws NotFoundError - If the user doesn't exist.
|
|
3216
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3217
|
+
*
|
|
3218
|
+
* @example
|
|
3219
|
+
* ```typescript
|
|
3220
|
+
* const response = await client.reddit.users.moderated("spez");
|
|
3221
|
+
* for (const sub of response.subreddits) {
|
|
3222
|
+
* console.log(`r/${sub.display_name}: ${sub.subscribers.toLocaleString()} subscribers`);
|
|
3223
|
+
* }
|
|
3224
|
+
* ```
|
|
3225
|
+
*/
|
|
3226
|
+
moderated(username: string): Promise<UserModeratedResponse>;
|
|
3227
|
+
/**
|
|
3228
|
+
* Get trophies awarded to a Reddit user.
|
|
3229
|
+
*
|
|
3230
|
+
* @param username - The Reddit username (without u/ prefix).
|
|
3231
|
+
* @returns List of trophies awarded to the user.
|
|
3232
|
+
* @throws NotFoundError - If the user doesn't exist.
|
|
3233
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
3234
|
+
*
|
|
3235
|
+
* @example
|
|
3236
|
+
* ```typescript
|
|
3237
|
+
* const response = await client.reddit.users.trophies("spez");
|
|
3238
|
+
* for (const trophy of response.trophies) {
|
|
3239
|
+
* console.log(`${trophy.name}${trophy.description ? `: ${trophy.description}` : ""}`);
|
|
3240
|
+
* }
|
|
3241
|
+
* ```
|
|
3242
|
+
*/
|
|
3243
|
+
trophies(username: string): Promise<UserTrophiesResponse>;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
/**
|
|
3247
|
+
* Reddit API client.
|
|
3248
|
+
*
|
|
3249
|
+
* Provides access to all Reddit API endpoints through specialized sub-clients.
|
|
3250
|
+
*/
|
|
3251
|
+
|
|
3252
|
+
/**
|
|
3253
|
+
* Reddit API client with access to all Reddit endpoints.
|
|
3254
|
+
*
|
|
3255
|
+
* Provides sub-clients for different resource types:
|
|
3256
|
+
* - `search` - Search posts, subreddits, users, and domain posts
|
|
3257
|
+
* - `posts` - Trending posts, post details, comments, and cross-posts
|
|
3258
|
+
* - `subreddits` - Subreddit details, posts, rules, moderators, and wiki pages
|
|
3259
|
+
* - `users` - User profiles, posts, comments, moderated subreddits, and trophies
|
|
3260
|
+
*
|
|
3261
|
+
* @example
|
|
3262
|
+
* ```typescript
|
|
3263
|
+
* const client = new ScrapeBadger({ apiKey: "key" });
|
|
3264
|
+
*
|
|
3265
|
+
* // Search posts
|
|
3266
|
+
* const results = await client.reddit.search.posts({ query: "typescript tips" });
|
|
3267
|
+
*
|
|
3268
|
+
* // Get subreddit details
|
|
3269
|
+
* const sub = await client.reddit.subreddits.get("programming");
|
|
3270
|
+
*
|
|
3271
|
+
* // Get user profile
|
|
3272
|
+
* const user = await client.reddit.users.get("spez");
|
|
3273
|
+
*
|
|
3274
|
+
* // Get trending posts
|
|
3275
|
+
* const trending = await client.reddit.posts.trending({ sort: "hot" });
|
|
3276
|
+
* ```
|
|
3277
|
+
*/
|
|
3278
|
+
declare class RedditClient {
|
|
3279
|
+
/** Client for search operations (posts, subreddits, users, domain posts) */
|
|
3280
|
+
readonly search: SearchClient;
|
|
3281
|
+
/** Client for post operations (trending, details, comments, duplicates) */
|
|
3282
|
+
readonly posts: PostsClient;
|
|
3283
|
+
/** Client for subreddit operations (details, posts, rules, moderators, wiki) */
|
|
3284
|
+
readonly subreddits: SubredditsClient;
|
|
3285
|
+
/** Client for user operations (profile, posts, comments, moderated, trophies) */
|
|
3286
|
+
readonly users: UsersClient;
|
|
3287
|
+
/**
|
|
3288
|
+
* Create a new Reddit client.
|
|
3289
|
+
*
|
|
3290
|
+
* @param client - The base HTTP client for making requests.
|
|
3291
|
+
*/
|
|
3292
|
+
constructor(client: BaseClient);
|
|
3293
|
+
}
|
|
3294
|
+
|
|
1959
3295
|
/**
|
|
1960
3296
|
* Main ScrapeBadger client.
|
|
1961
3297
|
*
|
|
@@ -2004,6 +3340,8 @@ declare class ScrapeBadger {
|
|
|
2004
3340
|
readonly vinted: VintedClient;
|
|
2005
3341
|
/** Google Scraper API client — 19 Google product APIs */
|
|
2006
3342
|
readonly google: GoogleClient;
|
|
3343
|
+
/** Reddit scraper API client */
|
|
3344
|
+
readonly reddit: RedditClient;
|
|
2007
3345
|
/**
|
|
2008
3346
|
* Create a new ScrapeBadger client.
|
|
2009
3347
|
*
|
|
@@ -2032,4 +3370,4 @@ declare class ScrapeBadger {
|
|
|
2032
3370
|
constructor(config?: Partial<ScrapeBadgerConfig>);
|
|
2033
3371
|
}
|
|
2034
3372
|
|
|
2035
|
-
export { type AiModeSearchParams, type AutocompleteParams, type DetectOptions, type DetectResult, type FinanceQuoteParams, type FlightsSearchParams, type FlightsStopsFilter, type FlightsTravelClass, type FlightsTripType, AiModeClient as GoogleAiModeClient, AutocompleteClient as GoogleAutocompleteClient, GoogleClient, FinanceClient as GoogleFinanceClient, FlightsClient as GoogleFlightsClient, HotelsClient as GoogleHotelsClient, ImagesClient as GoogleImagesClient, JobsClient as GoogleJobsClient, LensClient as GoogleLensClient, MapsClient as GoogleMapsClient, NewsClient as GoogleNewsClient, PatentsClient as GooglePatentsClient, ProductsClient as GoogleProductsClient, type GoogleResponse, ScholarClient as GoogleScholarClient, SearchClient as GoogleSearchClient, type GoogleSearchParams, ShoppingClient as GoogleShoppingClient, ShortsClient as GoogleShortsClient, TrendsClient as GoogleTrendsClient, VideosClient as GoogleVideosClient, type HotelsDetailsParams, type HotelsSearchParams, type ImagesSearchParams, type JobsSearchParams, type LensSearchParams, type MapsPhotosParams, type MapsPlaceParams, type MapsPostsParams, type MapsReviewsParams, type MapsSearchParams, type NewsSearchParams, type NewsTopicsParams, type NewsTrendingParams, type PatentsDetailParams, type PatentsSearchParams, type ProductsDetailParams, type ScholarAuthorCitationParams, type ScholarAuthorParams, type ScholarCiteParams, type ScholarProfilesParams, type ScholarSearchParams, ScrapeBadger, ScrapeBadgerConfig, type ScrapeOptions, type ScrapeResult, type ShoppingClickParams, type ShoppingProductParams, type ShoppingSearchParams, type ShortsSearchParams, type TrendsAutocompleteParams, type TrendsInterestParams, type TrendsRegionsParams, type TrendsRelatedParams, type TrendsTrendingParams, TwitterClient, type VideosSearchParams, type VintedBrand, type BrandsResponse as VintedBrandsResponse, VintedClient, type VintedColor, type ColorsResponse as VintedColorsResponse, type VintedItemDetail, type ItemDetailResponse as VintedItemDetailResponse, type VintedItemSummary, ItemsClient as VintedItemsClient, type VintedMarket, type MarketsResponse as VintedMarketsResponse, type VintedPagination, type VintedPhoto, type VintedPrice, ReferenceClient as VintedReferenceClient, SearchClient$
|
|
3373
|
+
export { type AiModeSearchParams, type AutocompleteParams, type DetectOptions, type DetectResult, type DomainPostsResponse, type FinanceQuoteParams, type FlightsSearchParams, type FlightsStopsFilter, type FlightsTravelClass, type FlightsTripType, AiModeClient as GoogleAiModeClient, AutocompleteClient as GoogleAutocompleteClient, GoogleClient, FinanceClient as GoogleFinanceClient, FlightsClient as GoogleFlightsClient, HotelsClient as GoogleHotelsClient, ImagesClient as GoogleImagesClient, JobsClient as GoogleJobsClient, LensClient as GoogleLensClient, MapsClient as GoogleMapsClient, NewsClient as GoogleNewsClient, PatentsClient as GooglePatentsClient, ProductsClient as GoogleProductsClient, type GoogleResponse, ScholarClient as GoogleScholarClient, SearchClient$1 as GoogleSearchClient, type GoogleSearchParams, ShoppingClient as GoogleShoppingClient, ShortsClient as GoogleShortsClient, TrendsClient as GoogleTrendsClient, VideosClient as GoogleVideosClient, type HotelsDetailsParams, type HotelsSearchParams, type ImagesSearchParams, type JobsSearchParams, type LensSearchParams, type MapsPhotosParams, type MapsPlaceParams, type MapsPostsParams, type MapsReviewsParams, type MapsSearchParams, type NewsSearchParams, type NewsTopicsParams, type NewsTrendingParams, type PatentsDetailParams, type PatentsSearchParams, type PopularSubredditsResponse, type PostCommentsResponse, type PostDetailResponse, type PostDuplicatesResponse, type ProductsDetailParams, RedditClient, type RedditComment, type RedditPagination, type RedditPost, PostsClient as RedditPostsClient, type RedditRule, SearchClient as RedditSearchClient, type RedditSubreddit, SubredditsClient as RedditSubredditsClient, type RedditTrophy, type RedditUser, type UserProfileResponse as RedditUserProfileResponse, UsersClient as RedditUsersClient, type RedditWikiPage, type ScholarAuthorCitationParams, type ScholarAuthorParams, type ScholarCiteParams, type ScholarProfilesParams, type ScholarSearchParams, ScrapeBadger, ScrapeBadgerConfig, type ScrapeOptions, type ScrapeResult, type SearchPostsResponse, type SearchSubredditsResponse, type SearchUsersResponse, type ShoppingClickParams, type ShoppingProductParams, type ShoppingSearchParams, type ShortsSearchParams, type SubredditDetailResponse, type SubredditPostsResponse, type SubredditRulesResponse, type SubredditWikiPagesResponse, type TrendingPostsResponse, type TrendsAutocompleteParams, type TrendsInterestParams, type TrendsRegionsParams, type TrendsRelatedParams, type TrendsTrendingParams, TwitterClient, type UserCommentsResponse, type UserModeratedResponse, type UserPostsResponse, type UserTrophiesResponse, type VideosSearchParams, type VintedBrand, type BrandsResponse as VintedBrandsResponse, VintedClient, type VintedColor, type ColorsResponse as VintedColorsResponse, type VintedItemDetail, type ItemDetailResponse as VintedItemDetailResponse, type VintedItemSummary, ItemsClient as VintedItemsClient, type VintedMarket, type MarketsResponse as VintedMarketsResponse, type VintedPagination, type VintedPhoto, type VintedPrice, ReferenceClient as VintedReferenceClient, SearchClient$2 as VintedSearchClient, type VintedSearchParams, type SearchResponse as VintedSearchResponse, type VintedSellerSummary, type VintedStatus, type StatusesResponse as VintedStatusesResponse, type UserItemsResponse as VintedUserItemsResponse, type VintedUserProfile, type UserProfileResponse$1 as VintedUserProfileResponse, type VintedUserSummary, UsersClient$1 as VintedUsersClient, WebClient, type WikiPageResponse };
|