SuperAPI AI Directory

twitter-watch

Data & analytics

View repository

Updated 10-15 17:31

About this skill

twitter-watch

An Agent skill that automatically monitors Twitter engagement data, designed to obtain the most accurate tweet performance metrics by simulating real human behavior.

How It Works and Design Intent

To ensure scraping success and evade anti-crawler mechanisms,watch.py the script adopts the following design:

  • Automatic configuration: On startup, the script automatically checks and ensures that ~/.agent-browser/config.json is configured in {"autoConnect": true}, which ensures that agent-browser preferentially attempts to connect to the user's already-open real browser.
  • Forced headed mode: All commands include the --headed parameter to ensure the browser interface is visible, making it easy for the user to monitor and intervene when necessary (such as handling CAPTCHAs).
  • Real browser verification: The script checks navigator.userAgent. If it is still in Headless mode or no connection has been established, the script will issue a warning.
  • Persistent session: Uses --session-name twitter-watch. If the user is already logged in in the browser, the script will inherit the login state.
  • Human-like scrolling and random delays: Simulates real user behavior to trigger dynamic loading of tweets.

Usage

1. Instructions for non-technical users (when users ask how to use it)

If the user asks how to use this feature, pleasebe sure toprovide the following concise operating guide:

Twitter monitoring usage instructions:

  1. Enable browser debugging mode: Enter chrome://inspect/#remote-debugging in the Chrome address bar and press Enter, and make sure "Allow remote debugging" is checked.
  2. Prepare the environment: The script will automatically configure agent-browserfor you. During use, if Chrome displays a "Allow remote debugging?" prompt, be sure to click **"Allow"**.
  3. Prepare the link file: Put the Twitter links you want to monitor into a text file (such as links.txt), one per line.
  4. Send the file path: Send the file path to me, and I will automatically scrape the data and generate a twitter_report.md report.

2. Execution flow (required reading for Agent)

  1. Environment preparation: Ensure that agent-browser and python3。
  2. Manual verification:
    • First run:agent-browser --headed --session-name twitter-watch open https://www.google.com。
    • Use ask_user to confirm that the user has seen the window and allowed the connection.
  3. Start monitoring:
    python3 skills/twitter-watch/scripts/watch.py links.txt
    

Output specifications

1. Single result (JSON)

File name:output_<tweet_id>.json Contains the raw (original text) and val (numeric value) fields.

2. Summary report (Markdown)

File name:twitter_report.md Contains operating system information, generation time, and a table with formatted numbers.

Environment requirements

  • Python 3.6+
  • Node.js & NPM
  • agent-browser CLI
  • Google Chrome browser (remote debugging enabled)