Skip to content

Latest commit

 

History

History
260 lines (213 loc) · 17.7 KB

File metadata and controls

260 lines (213 loc) · 17.7 KB

Browser Scripts

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/LinuxF12 or Ctrl+Shift+I
    • macOSCmd+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

Setting Why you would change it
dryRun true to preview, false to act. Always preview first.
whitelist Usernames to never touch. Add friends, clients, and your alt account before a bulk run.
maxUnfollows Cap the run. Start at 50 to see how X reacts to your account before letting it loose.
delay Milliseconds between actions. Lower is faster and likelier to hit a rate limit. See below.
exportOnComplete Downloads 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.


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

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

Script What it does Run it on
accountHealthMonitor Computing a 0-100 account health score x.com/USERNAME
algorithmBuilder Training X's algorithm by engaging with niche content x.com/home or x.com/search
articlePublisher Publishing long-form articles on X (Premium+ required) x.com/compose/article
audienceDemographics Analyzing follower bios, niches, locations, verified status x.com/USERNAME/followers
audienceOverlap Analyzing shared followers between X accounts x.com/ACCOUNT/followers
auditFollowers Auditing follower quality on X/Twitter x.com/USERNAME/followers
autoEngage Automated engagement on X/Twitter x.com/home or any feed
autoPlugReplies Auto-replying to your viral tweets with a plug x.com/YOUR_USERNAME
autoReply Auto-replying to tweets matching keyword triggers x.com/home or any timeline/search
autoRepost Auto-reposting tweets matching keywords or users x.com/home or any timeline/search
backupAccount Backing up your X/Twitter profile and tweets as JSON x.com/YOUR_USERNAME
bestTimeToPost Finding optimal posting times via engagement heatmap x.com/USERNAME
blockBots Detecting and blocking bot accounts on X/Twitter x.com/USERNAME/followers
bookmarkManager Exporting and clearing bookmarks on X/Twitter x.com/i/bookmarks
bookmarkOrganizer Categorizing bookmarks by keywords on X/Twitter x.com/i/bookmarks
bulkDeleteTweets Bulk deleting tweets with filters x.com/YOUR_USERNAME (your profile)
businessAnalytics X/Twitter business analytics and brand monitoring x.com or business.x.com
businessTools Brand mention monitoring and sentiment analysis x.com/search or any timeline
clearAllBookmarks Clearing all bookmarks on X/Twitter x.com/i/bookmarks
clearAllReposts Removing all reposts/retweets from your profile x.com/YOUR_USERNAME (your profile)
competitorAnalysis Comparing competitor account stats and engagement x.com (any page)
contentCalendar Analyzing posting patterns and schedule visualization x.com/USERNAME (your profile)
contentRepurposer Repurposing top tweets into threads, storms, blog outlines x.com/YOUR_USERNAME
continuousMonitor Continuous auto-refresh monitoring of followers/following x.com/USERNAME/followers or /following
createPoll Creating a poll tweet on X/Twitter x.com
creatorStudio Analyzing account analytics and content performance x.com/USERNAME (your profile)
detectUnfollowers Detecting who unfollowed you on X/Twitter x.com/USERNAME/followers
discoveryExplore Scraping trending topics and search results on X/Twitter x.com/explore
dmExporter Browser console script to export X/Twitter DM conversations x.com/messages
dmManager Sending DMs and exporting conversations on X/Twitter x.com/messages
downloadAccountData Triggering X/Twitter's official data archive download x.com/settings/download_your_data
editProfile Browser console script to update X/Twitter profile fields x.com/settings/profile
engagementAnalytics Scraping engagement metrics from a profile x.com/USERNAME
engagementBooster Boosting engagement — like & reply to matching tweets x.com/home or any timeline/search
engagementLeaderboard Tracking who engages most with your content x.com/YOUR_USERNAME
engagementManager Liking, bookmarking, or replying to visible tweets x.com/home or any timeline
followerGrowthTracker Tracking follower growth over time on X/Twitter x.com/USERNAME (any profile page)
followRatioManager Analyzing and optimizing your follow/following ratio x.com/YOUR_USERNAME
grokIntegration Interacting with Grok AI on X x.com/i/grok
hashtagAnalytics Analyzing hashtag frequency and engagement x.com/search or any timeline
joinCommunities Discovering and joining X communities by keyword x.com/i/communities/suggested
keywordLiker Like only posts containing specific keywords — with a prompt input box x.com/home or any feed/search page
keywordMonitor Monitoring timeline keywords and alerting on matches x.com/search?q=keyword or x.com/home
leaveAllCommunities Leaving all X communities x.com/USERNAME/communities
listManager Creating and managing X/Twitter lists x.com/i/lists
manageBookmarks Browser console script to export and manage X/Twitter bookmarks x.com/i/bookmarks
manageLists Browser console script to manage X/Twitter Lists x.com/i/lists
manageMutedWords Bulk-adding muted words on X/Twitter x.com/settings/muted_keywords
manageNotifications Browser console script to scrape and manage X/Twitter notifications x.com/notifications
manageSettings Browser console script to export and audit X/Twitter settings x.com/settings
massBlock Mass blocking users on X/Twitter x.com (followers, following, search, or any page with user cells)
massUnblock Mass unblocking users on X/Twitter x.com/settings/blocked
massUnmute Mass unmuting users on X/Twitter x.com/settings/muted
monitorAccount Tracking follows/unfollows on any public account x.com/USERNAME/followers or /following
multiAccountTimelineLiker Like the entire timeline of multiple X accounts in sequence x.com
muteByKeywords Muting users by tweet keywords on X/Twitter x.com (any timeline or search page)
newFollowersAlert Detecting new followers on X/Twitter x.com/USERNAME/followers
notificationManager Scraping and filtering notifications on X/Twitter x.com/notifications
personaEngine Analyzing your posting style and generating a persona profile x.com/YOUR_USERNAME
pinTweetManager Pinning your best-performing tweet x.com/YOUR_USERNAME (your profile)
pollCreator Browser console script to create polls on X/Twitter x.com/compose/tweet
postComposer Browser console script to compose and post tweets, threads, and polls x.com
postThread Posting a thread of connected tweets on X/Twitter x.com
premiumFeatures Browser console script to check X/Twitter Premium status and features x.com
premiumManager Detecting Premium tier and features on X/Twitter x.com
profileManager Scraping profile data from any X/Twitter profile page x.com/USERNAME
publishArticle Publishing articles on X/Twitter (Premium+) x.com/compose/article
qrCodeSharing Generating a QR code for any X/Twitter profile x.com/USERNAME
quoteTweetAutomation Auto quote-tweeting matching tweets with templates x.com/home or any timeline/search
removeFollowers Removing followers via soft-block on X/Twitter x.com/USERNAME/followers
reportSpam Reporting spam accounts on X/Twitter x.com (any page)
schedulePosts Scheduling posts using X/Twitter's native scheduler x.com
scrapeAnalytics Browser console script to scrape X/Twitter analytics data x.com/i/account_analytics or any post
scrapeExplore Browser console script to scrape Explore page trends and content x.com/explore
scrapeSpaces Browser console script to scrape X/Twitter Spaces data x.com/i/spaces or a Space page
sendDirectMessage Sending personalized DMs to multiple users on X/Twitter x.com/messages
sentimentAnalyzer Analyzing tweet sentiment using a basic lexicon x.com (any timeline or search)
settingsManager Exporting settings and toggling protection on X/Twitter x.com/settings
shadowbanChecker Checking if your X/Twitter account is shadowbanned x.com (any page, logged in)
spacesManager Scraping live and scheduled Spaces on X/Twitter x.com/i/spaces or x.com/explore
threadComposer Interactive thread composing with draft persistence x.com
trendingTopicMonitor Tracking trending topics and detecting rising trends x.com/explore/tabs/trending
tweetABTester A/B testing tweet variants and comparing engagement x.com
tweetPerformance Ranking tweets by engagement and categorizing by type x.com/USERNAME
tweetPriceCorrelation Browser console script — correlate a founder's tweet frequency with token price movements x.com/USERNAME (any crypto founder's profile)
tweetScheduleOptimizer Generating an optimal weekly posting schedule x.com/USERNAME
unfollowback Unfollowing non-followers on X/Twitter x.com/USERNAME/following
unfollowEveryone Unfollowing everyone on X/Twitter x.com/USERNAME/following
unfollowWDFBLog Unfollowing non-followers with detailed logging x.com/USERNAME/following
unlikeAllPosts Unliking all your liked posts on X/Twitter x.com/YOUR_USERNAME/likes
updateProfile Updating your X/Twitter profile fields x.com/YOUR_USERNAME
viralTweetDetector Detecting tweets with unusually high engagement (viral) x.com (any timeline or search)
welcomeNewFollowers Welcoming new followers with DMs on X/Twitter x.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.


Related