@the-convocation/twitter-scraper
Advanced tools
Comparing version 0.8.3 to 0.9.0
@@ -42,4 +42,5 @@ export interface EndpointFieldInfo { | ||
readonly TweetResultByRestId: "https://twitter.com/i/api/graphql/DJS3BdhUhcaEpZ7B7irJDg/TweetResultByRestId?variables=%7B%22tweetId%22%3A%221237110546383724547%22%2C%22withCommunity%22%3Afalse%2C%22includePromotedContent%22%3Afalse%2C%22withVoice%22%3Afalse%7D&features=%7B%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Afalse%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22responsive_web_media_download_video_enabled%22%3Afalse%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D"; | ||
readonly ListTweets: "https://twitter.com/i/api/graphql/whF0_KH1fCkdLLoyNPMoEw/ListLatestTweetsTimeline?variables=%7B%22listId%22%3A%221736495155002106192%22%2C%22count%22%3A20%7D&features=%7B%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Afalse%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_media_download_video_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D"; | ||
}>; | ||
export {}; | ||
//# sourceMappingURL=api-data.d.ts.map |
@@ -18,2 +18,3 @@ "use strict"; | ||
TweetResultByRestId: 'https://twitter.com/i/api/graphql/DJS3BdhUhcaEpZ7B7irJDg/TweetResultByRestId?variables=%7B%22tweetId%22%3A%221237110546383724547%22%2C%22withCommunity%22%3Afalse%2C%22includePromotedContent%22%3Afalse%2C%22withVoice%22%3Afalse%7D&features=%7B%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Afalse%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22responsive_web_media_download_video_enabled%22%3Afalse%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D', | ||
ListTweets: 'https://twitter.com/i/api/graphql/whF0_KH1fCkdLLoyNPMoEw/ListLatestTweetsTimeline?variables=%7B%22listId%22%3A%221736495155002106192%22%2C%22count%22%3A20%7D&features=%7B%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Afalse%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_media_download_video_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D', | ||
}; | ||
@@ -20,0 +21,0 @@ /** Wrapper class for API request information. */ |
@@ -82,2 +82,10 @@ import { Cookie } from 'tough-cookie'; | ||
/** | ||
* Fetches list tweets from Twitter. | ||
* @param listId The list id | ||
* @param maxTweets The maximum number of tweets to return. | ||
* @param cursor The search cursor, which can be passed into further requests for more results. | ||
* @returns A page of results, containing a cursor that can be used in further requests. | ||
*/ | ||
fetchListTweets(listId: string, maxTweets: number, cursor?: string): Promise<QueryTweetsResponse>; | ||
/** | ||
* Fetch the profiles a user is following | ||
@@ -84,0 +92,0 @@ * @param userId The user whose following should be returned |
@@ -98,2 +98,12 @@ "use strict"; | ||
/** | ||
* Fetches list tweets from Twitter. | ||
* @param listId The list id | ||
* @param maxTweets The maximum number of tweets to return. | ||
* @param cursor The search cursor, which can be passed into further requests for more results. | ||
* @returns A page of results, containing a cursor that can be used in further requests. | ||
*/ | ||
fetchListTweets(listId, maxTweets, cursor) { | ||
return (0, tweets_1.fetchListTweets)(listId, maxTweets, cursor, this.auth); | ||
} | ||
/** | ||
* Fetch the profiles a user is following | ||
@@ -100,0 +110,0 @@ * @param userId The user whose following should be returned |
@@ -90,3 +90,4 @@ import { LegacyUserRaw } from './profile'; | ||
export declare function parseTimelineEntryItemContentRaw(content: TimelineEntryItemContentRaw, entryId: string, isConversation?: boolean): Tweet | null; | ||
export declare function parseAndPush(tweets: Tweet[], content: TimelineEntryItemContentRaw, entryId: string, isConversation?: boolean): void; | ||
export declare function parseThreadedConversation(conversation: ThreadedConversation): Tweet[]; | ||
//# sourceMappingURL=timeline-v2.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseThreadedConversation = exports.parseTimelineEntryItemContentRaw = exports.parseTimelineTweetsV2 = exports.parseLegacyTweet = void 0; | ||
exports.parseThreadedConversation = exports.parseAndPush = exports.parseTimelineEntryItemContentRaw = exports.parseTimelineTweetsV2 = exports.parseLegacyTweet = void 0; | ||
const timeline_tweet_util_1 = require("./timeline-tweet-util"); | ||
@@ -195,2 +195,3 @@ const type_util_1 = require("./type-util"); | ||
} | ||
exports.parseAndPush = parseAndPush; | ||
function parseThreadedConversation(conversation) { | ||
@@ -197,0 +198,0 @@ const tweets = []; |
@@ -100,2 +100,3 @@ import { TwitterAuth } from './auth'; | ||
export declare function fetchTweets(userId: string, maxTweets: number, cursor: string | undefined, auth: TwitterAuth): Promise<QueryTweetsResponse>; | ||
export declare function fetchListTweets(listId: string, maxTweets: number, cursor: string | undefined, auth: TwitterAuth): Promise<QueryTweetsResponse>; | ||
export declare function getTweets(user: string, maxTweets: number, auth: TwitterAuth): AsyncGenerator<Tweet, void>; | ||
@@ -102,0 +103,0 @@ export declare function getTweetsByUserId(userId: string, maxTweets: number, auth: TwitterAuth): AsyncGenerator<Tweet, void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTweetAnonymous = exports.getTweet = exports.getLatestTweet = exports.getTweetsWhere = exports.getTweetWhere = exports.getTweetsByUserId = exports.getTweets = exports.fetchTweets = exports.features = void 0; | ||
exports.getTweetAnonymous = exports.getTweet = exports.getLatestTweet = exports.getTweetsWhere = exports.getTweetWhere = exports.getTweetsByUserId = exports.getTweets = exports.fetchListTweets = exports.fetchTweets = exports.features = void 0; | ||
const api_1 = require("./api"); | ||
@@ -9,2 +9,3 @@ const profile_1 = require("./profile"); | ||
const api_data_1 = require("./api-data"); | ||
const timeline_list_1 = require("./timeline-list"); | ||
exports.features = (0, api_1.addApiFeatures)({ | ||
@@ -35,2 +36,19 @@ interactive_text_enabled: true, | ||
exports.fetchTweets = fetchTweets; | ||
async function fetchListTweets(listId, maxTweets, cursor, auth) { | ||
if (maxTweets > 200) { | ||
maxTweets = 200; | ||
} | ||
const listTweetsRequest = api_data_1.apiRequestFactory.createListTweetsRequest(); | ||
listTweetsRequest.variables.listId = listId; | ||
listTweetsRequest.variables.count = maxTweets; | ||
if (cursor != null && cursor != '') { | ||
listTweetsRequest.variables['cursor'] = cursor; | ||
} | ||
const res = await (0, api_1.requestApi)(listTweetsRequest.toRequestUrl(), auth); | ||
if (!res.success) { | ||
throw res.err; | ||
} | ||
return (0, timeline_list_1.parseListTimelineTweets)(res.value); | ||
} | ||
exports.fetchListTweets = fetchListTweets; | ||
function getTweets(user, maxTweets, auth) { | ||
@@ -37,0 +55,0 @@ return (0, timeline_async_1.getTweetTimeline)(user, maxTweets, async (q, mt, c) => { |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["x", "twitter", "scraper"], | ||
"version": "0.8.3", | ||
"version": "0.9.0", | ||
"main": "dist/_module.js", | ||
@@ -8,0 +8,0 @@ "repository": "https://github.com/the-convocation/twitter-scraper.git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240569
87
3318
5