Browser Scripts

August 28, 2026 · View on GitHub

The zero-install surface. Copy a script, paste it into your browser's DevTools console on x.com, and it runs against the page you already have open, using the session you are already logged into.

No npm install, no API key, no cookie extraction, no server. This is the fastest way to try XActions, and for one-off cleanup jobs it is often the right tool rather than a fallback.


How to run one

  1. Open the page the script expects (each one names it below). For most, that is https://x.com/YOUR_USERNAME/following.
  2. Open DevTools:
    • Windows/Linux — F12 or Ctrl+Shift+I
    • macOS — Cmd+Option+I
  3. Click the Console tab.
  4. Paste the whole script and press Enter.

The first time you paste into a console, Chrome asks you to type allow pasting. That is a browser safety feature, not something XActions can skip.

Read what you paste. These scripts act as you, on your account. Every one in this repo is short enough to read end to end before you run it, and that is deliberate. Never paste a console script from anywhere without reading it.


Start in dry-run

Every destructive script ships with dryRun: true at the top of its CONFIG block. In that mode it walks the page, logs exactly what it would do, and changes nothing:

const CONFIG = {
  maxUnfollows: Infinity,   // Cap total unfollows (set to e.g. 50 for testing)
  whitelist: [],            // Usernames to never unfollow (without @)
  dryRun: true,             // Preview without acting — SET FALSE TO RUN
  delay: 2000,              // ms between unfollows
  scrollDelay: 2000,        // ms to wait after scroll
  maxEmptyScrolls: 6,       // Give up after N scrolls with no new users
  exportOnComplete: true,   // Auto-download JSON results
};

Run it once as-is, read the output, then set dryRun: false and run it again. Skipping this step is how people unfollow accounts they meant to keep.

The settings worth changing

SettingWhy you would change it
dryRuntrue to preview, false to act. Always preview first.
whitelistUsernames to never touch. Add friends, clients, and your alt account before a bulk run.
maxUnfollowsCap the run. Start at 50 to see how X reacts to your account before letting it loose.
delayMilliseconds between actions. Lower is faster and likelier to hit a rate limit. See below.
exportOnCompleteDownloads a JSON record of everything the script did. Keep this on.

Rate limits, and not getting locked out

X does not publish its automation limits, and they differ by account age, follower count, and verification status. What holds in practice:

  • Keep delay at 2000ms or higher. The defaults in this repo are chosen to look like a fast human rather than a script.
  • Stay under a few hundred write actions per day. Unfollows, follows, likes, and deletes all draw on the same budget.
  • Stop when actions start failing silently. A button that no longer responds means you are being throttled. Continuing turns a soft throttle into a temporary lock.
  • Spread big jobs over days. A 5,000-account cleanup is a week of runs, not an afternoon.

Scripts print their progress as they go. If the count stops climbing while the page keeps scrolling, stop the run.

Stopping a run

Reload the page. Every script is scoped to the page it runs on and holds no state elsewhere, so a refresh ends it immediately. Scripts with exportOnComplete write their JSON when they finish normally, so a run you abort early will not produce one.


Sweeping a whole profile

engageProfile.js is the one to reach for when you want to like, repost, and reply to everything an account has posted. It opens a floating panel, walks the profile to the end, verifies each action against the DOM, rests every 20 posts, backs off when X pushes back, and remembers what it did so a reload resumes. Replies come from your templates or from an LLM given a one-line brief; Grok works straight from the console, other providers need the extension. Details in engage.md.

Command line and library alternatives

The same jobs are available with more control from the CLI and the Node.js library, which stream results, resume, and export to CSV or Google Sheets:

npx xactions profile nasa
npx xactions non-followers YOUR_USERNAME
npx xactions tweets nasa --limit 200 --output tweets.csv

See the CLI reference, the examples, and the getting started guide.


The catalog

97 scripts. Generated by npm run docs:scripts from the header of each file in scripts/.

ScriptWhat it doesRun it on
accountHealthMonitorComputing a 0-100 account health scorex.com/USERNAME
algorithmBuilderTraining X's algorithm by engaging with niche contentx.com/home or x.com/search
articlePublisherPublishing long-form articles on X (Premium+ required)x.com/compose/article
audienceDemographicsAnalyzing follower bios, niches, locations, verified statusx.com/USERNAME/followers
audienceOverlapAnalyzing shared followers between X accountsx.com/ACCOUNT/followers
auditFollowersAuditing follower quality on X/Twitterx.com/USERNAME/followers
autoEngageAutomated engagement on X/Twitterx.com/home or any feed
autoPlugRepliesAuto-replying to your viral tweets with a plugx.com/YOUR_USERNAME
autoReplyAuto-replying to tweets matching keyword triggersx.com/home or any timeline/search
autoRepostAuto-reposting tweets matching keywords or usersx.com/home or any timeline/search
backupAccountBacking up your X/Twitter profile and tweets as JSONx.com/YOUR_USERNAME
bestTimeToPostFinding optimal posting times via engagement heatmapx.com/USERNAME
blockBotsDetecting and blocking bot accounts on X/Twitterx.com/USERNAME/followers
bookmarkManagerExporting and clearing bookmarks on X/Twitterx.com/i/bookmarks
bookmarkOrganizerCategorizing bookmarks by keywords on X/Twitterx.com/i/bookmarks
bulkDeleteTweetsBulk deleting tweets with filtersx.com/YOUR_USERNAME (your profile)
businessAnalyticsX/Twitter business analytics and brand monitoringx.com or business.x.com
businessToolsBrand mention monitoring and sentiment analysisx.com/search or any timeline
clearAllBookmarksClearing all bookmarks on X/Twitterx.com/i/bookmarks
clearAllRepostsRemoving all reposts/retweets from your profilex.com/YOUR_USERNAME (your profile)
competitorAnalysisComparing competitor account stats and engagementx.com (any page)
contentCalendarAnalyzing posting patterns and schedule visualizationx.com/USERNAME (your profile)
contentRepurposerRepurposing top tweets into threads, storms, blog outlinesx.com/YOUR_USERNAME
continuousMonitorContinuous auto-refresh monitoring of followers/followingx.com/USERNAME/followers or /following
createPollCreating a poll tweet on X/Twitterx.com
creatorStudioAnalyzing account analytics and content performancex.com/USERNAME (your profile)
detectUnfollowersDetecting who unfollowed you on X/Twitterx.com/USERNAME/followers
discoveryExploreScraping trending topics and search results on X/Twitterx.com/explore
dmExporterBrowser console script to export X/Twitter DM conversationsx.com/messages
dmManagerSending DMs and exporting conversations on X/Twitterx.com/messages
downloadAccountDataTriggering X/Twitter's official data archive downloadx.com/settings/download_your_data
editProfileBrowser console script to update X/Twitter profile fieldsx.com/settings/profile
engagementAnalyticsScraping engagement metrics from a profilex.com/USERNAME
engagementBoosterBoosting engagement — like & reply to matching tweetsx.com/home or any timeline/search
engagementLeaderboardTracking who engages most with your contentx.com/YOUR_USERNAME
engagementManagerLiking, bookmarking, or replying to visible tweetsx.com/home or any timeline
engageProfileLike, repost, and comment on every post in a feed: a profile, a search, a list, a hashtag, or homex.com/USERNAME, a search, a list, a hashtag, or x.com/home
followerGrowthTrackerTracking follower growth over time on X/Twitterx.com/USERNAME (any profile page)
followRatioManagerAnalyzing and optimizing your follow/following ratiox.com/YOUR_USERNAME
grokIntegrationInteracting with Grok AI on Xx.com/i/grok
hashtagAnalyticsAnalyzing hashtag frequency and engagementx.com/search or any timeline
joinCommunitiesDiscovering and joining X communities by keywordx.com/i/communities/suggested
keywordLikerLike only posts containing specific keywords — with a prompt input boxx.com/home or any feed/search page
keywordMonitorMonitoring timeline keywords and alerting on matchesx.com/search?q=keyword or x.com/home
leaveAllCommunitiesLeaving all X communitiesx.com/USERNAME/communities
listManagerCreating and managing X/Twitter listsx.com/i/lists
manageBookmarksBrowser console script to export and manage X/Twitter bookmarksx.com/i/bookmarks
manageListsBrowser console script to manage X/Twitter Listsx.com/i/lists
manageMutedWordsBulk-adding muted words on X/Twitterx.com/settings/muted_keywords
manageNotificationsBrowser console script to scrape and manage X/Twitter notificationsx.com/notifications
manageSettingsBrowser console script to export and audit X/Twitter settingsx.com/settings
massBlockMass blocking users on X/Twitterx.com (followers, following, search, or any page with user cells)
massUnblockMass unblocking users on X/Twitterx.com/settings/blocked
massUnmuteMass unmuting users on X/Twitterx.com/settings/muted
monitorAccountTracking follows/unfollows on any public accountx.com/USERNAME/followers or /following
multiAccountTimelineLikerLike the entire timeline of multiple X accounts in sequencex.com
muteByKeywordsMuting users by tweet keywords on X/Twitterx.com (any timeline or search page)
naturalFlowSimulate a natural browsing session: scroll, like, reply, retweet, follow, and check notifications on a human rhythmx.com/home
newFollowersAlertDetecting new followers on X/Twitterx.com/USERNAME/followers
notificationManagerScraping and filtering notifications on X/Twitterx.com/notifications
personaEngineAnalyzing your posting style and generating a persona profilex.com/YOUR_USERNAME
pinTweetManagerPinning your best-performing tweetx.com/YOUR_USERNAME (your profile)
pollCreatorBrowser console script to create polls on X/Twitterx.com/compose/tweet
postComposerBrowser console script to compose and post tweets, threads, and pollsx.com
postThreadPosting a thread of connected tweets on X/Twitterx.com
premiumFeaturesBrowser console script to check X/Twitter Premium status and featuresx.com
premiumManagerDetecting Premium tier and features on X/Twitterx.com
profileManagerScraping profile data from any X/Twitter profile pagex.com/USERNAME
publishArticlePublishing articles on X/Twitter (Premium+)x.com/compose/article
qrCodeSharingGenerating a QR code for any X/Twitter profilex.com/USERNAME
quoteTweetAutomationAuto quote-tweeting matching tweets with templatesx.com/home or any timeline/search
removeFollowersRemoving followers via soft-block on X/Twitterx.com/USERNAME/followers
reportSpamReporting spam accounts on X/Twitterx.com (any page)
reputationAuditAI-score your own timeline for professional, hostile, legal, and spam risk, get a shareable score card, and clean up what it flagsx.com/USERNAME (your own profile, or /with_replies)
schedulePostsScheduling posts using X/Twitter's native schedulerx.com
scrapeAnalyticsBrowser console script to scrape X/Twitter analytics datax.com/i/account_analytics or any post
scrapeExploreBrowser console script to scrape Explore page trends and contentx.com/explore
scrapeSpacesBrowser console script to scrape X/Twitter Spaces datax.com/i/spaces or a Space page
searchSweepDelete, like, repost, or reply to every post an X search returns, e.g. from:you @someonex.com/search?q=...
sendDirectMessageSending personalized DMs to multiple users on X/Twitterx.com/messages
sentimentAnalyzerAnalyzing tweet sentiment using a basic lexiconx.com (any timeline or search)
settingsManagerExporting settings and toggling protection on X/Twitterx.com/settings
shadowbanCheckerChecking if your X/Twitter account is shadowbannedx.com (any page, logged in)
spacesManagerScraping live and scheduled Spaces on X/Twitterx.com/i/spaces or x.com/explore
threadComposerInteractive thread composing with draft persistencex.com
trendingTopicMonitorTracking trending topics and detecting rising trendsx.com/explore/tabs/trending
tweetABTesterA/B testing tweet variants and comparing engagementx.com
tweetPerformanceRanking tweets by engagement and categorizing by typex.com/USERNAME
tweetPriceCorrelationBrowser console script — correlate a founder's tweet frequency with token price movementsx.com/USERNAME (any crypto founder's profile)
tweetScheduleOptimizerGenerating an optimal weekly posting schedulex.com/USERNAME
unfollowbackUnfollowing non-followers on X/Twitterx.com/USERNAME/following
unfollowEveryoneUnfollowing everyone on X/Twitterx.com/USERNAME/following
unfollowWDFBLogUnfollowing non-followers with detailed loggingx.com/USERNAME/following
unlikeAllPostsUnliking all your liked posts on X/Twitterx.com/YOUR_USERNAME/likes
updateProfileUpdating your X/Twitter profile fieldsx.com/YOUR_USERNAME
viralTweetDetectorDetecting tweets with unusually high engagement (viral)x.com (any timeline or search)
welcomeNewFollowersWelcoming new followers with DMs on X/Twitterx.com/USERNAME/followers

Writing your own

Browser scripts in this repo follow one shape, and matching it keeps the catalog above accurate (it is generated from these headers):

// scripts/myScript.js
// One line describing what it does
// Paste in DevTools console on x.com/home
// by yourhandle

(() => {
  const CONFIG = {
    dryRun: true,
    delay: 2000,
  };

  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

  // ... your logic
})();

Rules that keep a script safe to publish:

  • Wrap everything in an IIFE so it cannot collide with page globals.
  • Put every tunable value in a CONFIG object at the top, not inline.
  • Default dryRun to true for anything that writes.
  • Never hardcode a delay below 1000ms.
  • Log progress. A silent script is indistinguishable from a hung one.

Then regenerate the catalog:

npm run docs:scripts

See CONTRIBUTING.md.