@crawlkit-sh/sdk 1.0.2 → 1.1.0

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/dist/index.d.cts CHANGED
@@ -892,6 +892,15 @@ interface AppStoreReviewsOptions {
892
892
  /** Request timeout in milliseconds (default: 30000) */
893
893
  timeout?: number;
894
894
  }
895
+ /**
896
+ * Options for fetching App Store app details
897
+ */
898
+ interface AppStoreDetailOptions {
899
+ /** Language code (e.g., 'en', 'tr') */
900
+ lang?: string;
901
+ /** Request timeout in milliseconds */
902
+ timeout?: number;
903
+ }
895
904
  /**
896
905
  * Parameters for the App Store reviews endpoint
897
906
  */
@@ -903,6 +912,15 @@ interface AppStoreReviewsParams {
903
912
  /** Options */
904
913
  options?: AppStoreReviewsOptions;
905
914
  }
915
+ /**
916
+ * Parameters for the App Store detail endpoint
917
+ */
918
+ interface AppStoreDetailParams {
919
+ /** App ID (numeric ID from App Store URL) or URL */
920
+ appId: string;
921
+ /** Options */
922
+ options?: AppStoreDetailOptions;
923
+ }
906
924
  /**
907
925
  * App Store review
908
926
  */
@@ -932,10 +950,238 @@ interface AppStoreReviewsData {
932
950
  creditsUsed: number;
933
951
  creditsRemaining: number;
934
952
  }
953
+ /**
954
+ * Data returned from the App Store detail endpoint
955
+ * Endpoint fields can vary, so this type keeps known common fields
956
+ * while allowing extra keys from the API.
957
+ */
958
+ interface AppStoreDetailData {
959
+ appId?: string;
960
+ appName?: string;
961
+ developer?: string;
962
+ rating?: number;
963
+ ratingCount?: number;
964
+ reviewsCount?: number;
965
+ version?: string;
966
+ description?: string;
967
+ icon?: string;
968
+ screenshots?: string[];
969
+ timing?: {
970
+ total: number;
971
+ };
972
+ creditsUsed?: number;
973
+ creditsRemaining?: number;
974
+ [key: string]: unknown;
975
+ }
935
976
  /**
936
977
  * Response from the App Store reviews endpoint
937
978
  */
938
979
  type AppStoreReviewsResponse = ApiSuccessResponse<AppStoreReviewsData>;
980
+ /**
981
+ * Response from the App Store detail endpoint
982
+ */
983
+ type AppStoreDetailResponse = ApiSuccessResponse<AppStoreDetailData>;
984
+
985
+ /**
986
+ * Common options for TikTok crawl endpoints
987
+ */
988
+ interface TikTokOptions {
989
+ /** Request timeout in milliseconds */
990
+ timeout?: number;
991
+ }
992
+ /**
993
+ * Parameters for scraping a TikTok profile
994
+ */
995
+ interface TikTokProfileParams {
996
+ /** TikTok username (with or without @) */
997
+ username: string;
998
+ /** Options */
999
+ options?: TikTokOptions;
1000
+ }
1001
+ /**
1002
+ * Parameters for scraping a TikTok post
1003
+ */
1004
+ interface TikTokPostParams {
1005
+ /** TikTok post URL */
1006
+ url: string;
1007
+ /** Options */
1008
+ options?: TikTokOptions;
1009
+ }
1010
+ /**
1011
+ * Parameters for listing TikTok posts
1012
+ */
1013
+ interface TikTokPostsParams {
1014
+ /** TikTok username (with or without @) */
1015
+ username: string;
1016
+ /** Pagination cursor from previous response */
1017
+ cursor?: number;
1018
+ /** Optional secUid from previous response to speed up pagination */
1019
+ secUid?: string;
1020
+ /** Options */
1021
+ options?: TikTokOptions;
1022
+ }
1023
+ /**
1024
+ * TikTok profile stats
1025
+ */
1026
+ interface TikTokProfileStats {
1027
+ followers: number;
1028
+ following: number;
1029
+ likes: number;
1030
+ videos: number;
1031
+ friends?: number;
1032
+ digg?: number;
1033
+ }
1034
+ /**
1035
+ * TikTok profile data
1036
+ */
1037
+ interface TikTokProfile {
1038
+ id: string;
1039
+ secUid?: string | null;
1040
+ username: string;
1041
+ nickname?: string;
1042
+ bio?: string;
1043
+ bioLink?: string | null;
1044
+ avatar?: string;
1045
+ verified?: boolean;
1046
+ privateAccount?: boolean;
1047
+ isOrganization?: boolean;
1048
+ commerceUser?: boolean;
1049
+ category?: string | null;
1050
+ language?: string | null;
1051
+ region?: string | null;
1052
+ createdAt?: string | null;
1053
+ stats?: TikTokProfileStats;
1054
+ }
1055
+ /**
1056
+ * TikTok post author
1057
+ */
1058
+ interface TikTokPostAuthor {
1059
+ id?: string | null;
1060
+ username?: string | null;
1061
+ nickname?: string | null;
1062
+ avatar?: string | null;
1063
+ verified?: boolean;
1064
+ }
1065
+ /**
1066
+ * TikTok post music info
1067
+ */
1068
+ interface TikTokPostMusic {
1069
+ title?: string | null;
1070
+ author?: string | null;
1071
+ album?: string | null;
1072
+ duration?: number | null;
1073
+ coverUrl?: string | null;
1074
+ }
1075
+ /**
1076
+ * TikTok post video info
1077
+ */
1078
+ interface TikTokPostVideo {
1079
+ duration?: number | null;
1080
+ url?: string | null;
1081
+ coverUrl?: string | null;
1082
+ width?: number | null;
1083
+ height?: number | null;
1084
+ }
1085
+ /**
1086
+ * TikTok post image item
1087
+ */
1088
+ interface TikTokPostImage {
1089
+ index?: number;
1090
+ url: string;
1091
+ width?: number | null;
1092
+ height?: number | null;
1093
+ }
1094
+ /**
1095
+ * TikTok post stats
1096
+ */
1097
+ interface TikTokPostStats {
1098
+ plays?: number;
1099
+ likes?: number;
1100
+ comments?: number;
1101
+ shares?: number;
1102
+ saves?: number;
1103
+ reposts?: number;
1104
+ }
1105
+ /**
1106
+ * TikTok hashtag
1107
+ */
1108
+ interface TikTokHashtag {
1109
+ id: string;
1110
+ title: string;
1111
+ }
1112
+ /**
1113
+ * TikTok post item
1114
+ */
1115
+ interface TikTokPost {
1116
+ id: string;
1117
+ postUrl?: string | null;
1118
+ description?: string;
1119
+ createdAt?: string | null;
1120
+ mediaType?: 'video' | 'image';
1121
+ author?: TikTokPostAuthor;
1122
+ music?: TikTokPostMusic;
1123
+ video?: TikTokPostVideo;
1124
+ images?: TikTokPostImage[];
1125
+ stats?: TikTokPostStats;
1126
+ hashtags?: TikTokHashtag[];
1127
+ locationCreated?: string | null;
1128
+ isAd?: boolean;
1129
+ }
1130
+ /**
1131
+ * TikTok posts pagination data
1132
+ */
1133
+ interface TikTokPostsPagination {
1134
+ cursor?: string;
1135
+ hasMore?: boolean;
1136
+ total?: number;
1137
+ secUid?: string | null;
1138
+ }
1139
+ /**
1140
+ * Data returned from the TikTok profile endpoint
1141
+ */
1142
+ interface TikTokProfileData {
1143
+ profile: TikTokProfile;
1144
+ timing: {
1145
+ total: number;
1146
+ };
1147
+ creditsUsed: number;
1148
+ creditsRemaining: number;
1149
+ }
1150
+ /**
1151
+ * Data returned from the TikTok post endpoint
1152
+ */
1153
+ interface TikTokPostData {
1154
+ post: TikTokPost;
1155
+ timing: {
1156
+ total: number;
1157
+ };
1158
+ creditsUsed: number;
1159
+ creditsRemaining: number;
1160
+ }
1161
+ /**
1162
+ * Data returned from the TikTok posts endpoint
1163
+ */
1164
+ interface TikTokPostsData {
1165
+ posts: TikTokPost[];
1166
+ pagination: TikTokPostsPagination;
1167
+ timing: {
1168
+ total: number;
1169
+ };
1170
+ creditsUsed: number;
1171
+ creditsRemaining: number;
1172
+ }
1173
+ /**
1174
+ * Response from the TikTok profile endpoint
1175
+ */
1176
+ type TikTokProfileResponse = ApiSuccessResponse<TikTokProfileData>;
1177
+ /**
1178
+ * Response from the TikTok post endpoint
1179
+ */
1180
+ type TikTokPostResponse = ApiSuccessResponse<TikTokPostData>;
1181
+ /**
1182
+ * Response from the TikTok posts endpoint
1183
+ */
1184
+ type TikTokPostsResponse = ApiSuccessResponse<TikTokPostsData>;
939
1185
 
940
1186
  /**
941
1187
  * LinkedIn scraping operations
@@ -1098,6 +1344,26 @@ declare class AppStoreResource extends BaseResource {
1098
1344
  * @costs 1 credit
1099
1345
  */
1100
1346
  playstoreDetail(params: PlayStoreDetailParams): Promise<PlayStoreDetailData>;
1347
+ /**
1348
+ * Fetch Apple App Store app details
1349
+ *
1350
+ * @param params - App detail parameters
1351
+ * @returns App information including metadata, ratings, and media
1352
+ * @throws {CrawlKitError} On API errors
1353
+ *
1354
+ * @example
1355
+ * ```typescript
1356
+ * const result = await crawlkit.appstore.appstoreDetail({
1357
+ * appId: '1492793493',
1358
+ * options: { lang: 'en' }
1359
+ * });
1360
+ * console.log(result.appName);
1361
+ * console.log(result.rating);
1362
+ * ```
1363
+ *
1364
+ * @costs 1 credit
1365
+ */
1366
+ appstoreDetail(params: AppStoreDetailParams): Promise<AppStoreDetailData>;
1101
1367
  /**
1102
1368
  * Fetch Apple App Store reviews for an app
1103
1369
  *
@@ -1129,6 +1395,77 @@ declare class AppStoreResource extends BaseResource {
1129
1395
  appstoreReviews(params: AppStoreReviewsParams): Promise<AppStoreReviewsData>;
1130
1396
  }
1131
1397
 
1398
+ /**
1399
+ * TikTok scraping operations
1400
+ * Provides profile, single content, and paginated content list scraping
1401
+ */
1402
+ declare class TikTokResource extends BaseResource {
1403
+ /**
1404
+ * Scrape a TikTok profile
1405
+ *
1406
+ * @param params - Profile parameters (username)
1407
+ * @returns Profile data including stats and metadata
1408
+ * @throws {CrawlKitError} On API errors
1409
+ *
1410
+ * @example
1411
+ * ```typescript
1412
+ * const result = await crawlkit.tiktok.profile({
1413
+ * username: 'nike'
1414
+ * });
1415
+ * console.log(result.profile.username);
1416
+ * console.log(result.profile.stats?.followers);
1417
+ * ```
1418
+ *
1419
+ * @costs 1 credit
1420
+ */
1421
+ profile(params: TikTokProfileParams): Promise<TikTokProfileData>;
1422
+ /**
1423
+ * Scrape a single TikTok content item
1424
+ *
1425
+ * @param params - Post parameters (post URL)
1426
+ * @returns Post details including author, media, stats, and hashtags
1427
+ * @throws {CrawlKitError} On API errors
1428
+ *
1429
+ * @example
1430
+ * ```typescript
1431
+ * const result = await crawlkit.tiktok.content({
1432
+ * url: 'https://www.tiktok.com/@nike/video/1234567890'
1433
+ * });
1434
+ * console.log(result.post.id);
1435
+ * console.log(result.post.video?.url);
1436
+ * ```
1437
+ *
1438
+ * @costs 1 credit
1439
+ */
1440
+ content(params: TikTokPostParams): Promise<TikTokPostData>;
1441
+ /**
1442
+ * List TikTok content with cursor-based pagination
1443
+ *
1444
+ * @param params - Post list parameters (username and optional cursor/secUid)
1445
+ * @returns A page of posts and pagination metadata
1446
+ * @throws {CrawlKitError} On API errors
1447
+ *
1448
+ * @example
1449
+ * ```typescript
1450
+ * const firstPage = await crawlkit.tiktok.posts({
1451
+ * username: 'nike'
1452
+ * });
1453
+ *
1454
+ * if (firstPage.pagination.hasMore) {
1455
+ * const nextPage = await crawlkit.tiktok.posts({
1456
+ * username: 'nike',
1457
+ * cursor: Number(firstPage.pagination.cursor),
1458
+ * secUid: firstPage.pagination.secUid ?? undefined
1459
+ * });
1460
+ * console.log(nextPage.posts.length);
1461
+ * }
1462
+ * ```
1463
+ *
1464
+ * @costs 1 credit per page
1465
+ */
1466
+ posts(params: TikTokPostsParams): Promise<TikTokPostsData>;
1467
+ }
1468
+
1132
1469
  /**
1133
1470
  * Configuration options for the CrawlKit client
1134
1471
  */
@@ -1184,6 +1521,10 @@ interface CrawlKitConfig {
1184
1521
  * const company = await crawlkit.linkedin.company({
1185
1522
  * url: 'https://linkedin.com/company/openai'
1186
1523
  * });
1524
+ *
1525
+ * const profile = await crawlkit.tiktok.profile({
1526
+ * username: 'nike'
1527
+ * });
1187
1528
  * ```
1188
1529
  */
1189
1530
  declare class CrawlKit {
@@ -1204,6 +1545,11 @@ declare class CrawlKit {
1204
1545
  * Provides Google Play Store and Apple App Store data
1205
1546
  */
1206
1547
  readonly appstore: AppStoreResource;
1548
+ /**
1549
+ * TikTok scraping operations
1550
+ * Provides profile, content, and paginated posts scraping
1551
+ */
1552
+ readonly tiktok: TikTokResource;
1207
1553
  /**
1208
1554
  * Create a new CrawlKit client
1209
1555
  *
@@ -1413,4 +1759,4 @@ declare class NetworkError extends CrawlKitError {
1413
1759
  */
1414
1760
  declare function createErrorFromResponse(code: string, message: string, statusCode: number, creditsRefunded?: number, creditsRemaining?: number): CrawlKitError;
1415
1761
 
1416
- export { type ActionResult, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AppStoreReview, type AppStoreReviewsData, type AppStoreReviewsOptions, type AppStoreReviewsParams, type AppStoreReviewsResponse, AuthenticationError, type BrowserAction, type ClickAction, CrawlKit, type CrawlKitConfig, CrawlKitError, type CrawlStats, type CreditInfo, type DataSafety, type Developer, type DeveloperReply, type ErrorCode, type EvaluateAction, type ExtractData, type ExtractOptions, type ExtractParams, type ExtractResponse, type InstagramAudioInfo, type InstagramBioLink, type InstagramCarouselItem, type InstagramContent, type InstagramContentData, type InstagramContentOptions, type InstagramContentOwner, type InstagramContentParams, type InstagramContentResponse, type InstagramDimensions, type InstagramPost, type InstagramProfile, type InstagramProfileData, type InstagramProfileOptions, type InstagramProfileParams, type InstagramProfileResponse, InsufficientCreditsError, type LinkedInCompany, type LinkedInCompanyData, type LinkedInCompanyOptions, type LinkedInCompanyParams, type LinkedInCompanyResponse, type LinkedInEmployee, type LinkedInJob, type LinkedInPersonData, type LinkedInPersonParams, type LinkedInPersonResponse, type LinkedInPersonResult, type LinkedInPost, type LinkedInSimilarCompany, NetworkError, NotFoundError, type PageLinks, type PageMetadata, type Pagination, type Permission, type PlayStoreDetailData, type PlayStoreDetailOptions, type PlayStoreDetailParams, type PlayStoreDetailResponse, type PlayStoreReview, type PlayStoreReviewsData, type PlayStoreReviewsOptions, type PlayStoreReviewsParams, type PlayStoreReviewsResponse, type PressAction, RateLimitError, type RatingDistribution, type ScrapeData, type ScrapeOptions, type ScrapeParams, type ScrapeResponse, type Screenshot, type ScreenshotData, type ScreenshotOptions, type ScreenshotParams, type ScreenshotResponse, type ScrollAction, type SearchData, type SearchOptions, type SearchParams, type SearchResponse, type SearchResult, type TimeRange, TimeoutError, type Timing, type TypeAction, ValidationError, type WaitAction, createErrorFromResponse };
1762
+ export { type ActionResult, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AppStoreDetailData, type AppStoreDetailOptions, type AppStoreDetailParams, type AppStoreDetailResponse, type AppStoreReview, type AppStoreReviewsData, type AppStoreReviewsOptions, type AppStoreReviewsParams, type AppStoreReviewsResponse, AuthenticationError, type BrowserAction, type ClickAction, CrawlKit, type CrawlKitConfig, CrawlKitError, type CrawlStats, type CreditInfo, type DataSafety, type Developer, type DeveloperReply, type ErrorCode, type EvaluateAction, type ExtractData, type ExtractOptions, type ExtractParams, type ExtractResponse, type InstagramAudioInfo, type InstagramBioLink, type InstagramCarouselItem, type InstagramContent, type InstagramContentData, type InstagramContentOptions, type InstagramContentOwner, type InstagramContentParams, type InstagramContentResponse, type InstagramDimensions, type InstagramPost, type InstagramProfile, type InstagramProfileData, type InstagramProfileOptions, type InstagramProfileParams, type InstagramProfileResponse, InsufficientCreditsError, type LinkedInCompany, type LinkedInCompanyData, type LinkedInCompanyOptions, type LinkedInCompanyParams, type LinkedInCompanyResponse, type LinkedInEmployee, type LinkedInJob, type LinkedInPersonData, type LinkedInPersonParams, type LinkedInPersonResponse, type LinkedInPersonResult, type LinkedInPost, type LinkedInSimilarCompany, NetworkError, NotFoundError, type PageLinks, type PageMetadata, type Pagination, type Permission, type PlayStoreDetailData, type PlayStoreDetailOptions, type PlayStoreDetailParams, type PlayStoreDetailResponse, type PlayStoreReview, type PlayStoreReviewsData, type PlayStoreReviewsOptions, type PlayStoreReviewsParams, type PlayStoreReviewsResponse, type PressAction, RateLimitError, type RatingDistribution, type ScrapeData, type ScrapeOptions, type ScrapeParams, type ScrapeResponse, type Screenshot, type ScreenshotData, type ScreenshotOptions, type ScreenshotParams, type ScreenshotResponse, type ScrollAction, type SearchData, type SearchOptions, type SearchParams, type SearchResponse, type SearchResult, type TikTokHashtag, type TikTokOptions, type TikTokPost, type TikTokPostAuthor, type TikTokPostData, type TikTokPostImage, type TikTokPostMusic, type TikTokPostParams, type TikTokPostResponse, type TikTokPostStats, type TikTokPostVideo, type TikTokPostsData, type TikTokPostsPagination, type TikTokPostsParams, type TikTokPostsResponse, type TikTokProfile, type TikTokProfileData, type TikTokProfileParams, type TikTokProfileResponse, type TikTokProfileStats, type TimeRange, TimeoutError, type Timing, type TypeAction, ValidationError, type WaitAction, createErrorFromResponse };