npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lilyn/twitter-scraper

v1.2.2

Published

A twitter scraper for all your needs.

Downloads

7

Readme

twit-puppeteer-loho

twitter-scraper

A puppeteer-core powered scraper for Twitter.

Installation

npm i @lilyn/twitter-scraper

  • from this: https://www.npmjs.com/package/@lilyn/twitter-scraper

Typescript Usage

It's still in a minimal state, will add new features to it soon.

async function main() {
    const browser = new CustomBrowser();
    await browser.init({
        headless: true,
        execPath: "C:/Program Files/Google/Chrome/Application/chrome.exe" 
    });
    const lilyn = new TwitterUser(browser, "LilynHana");
    await lilyn.init();

    // get profile info!
    await lilyn.getProfile();

    // get tweets every n scroll down
    await lilyn.getTweetsbyPage(2);

    // https://twitter.com/LilynHana/status/1624553417120022531
    // gets every tweets until you encounter that tweet.
    await lilyn.getTweetsUntilID("1624553417120022531");

    // dont forget to close the browser
    await browser.close()
}

CLI Usage


$ twitter-scraper
Commands:
  bin.js getProfile [at]                    Get the profile of the user/s.
  bin.js getTweetsByPage [number-of-pages]  Get the tweets of a user/s by pages.
  [at]
  bin.js getTweetsUntilID [at] [id]         Scan every tweet until it encounters
                                            the id. Example: getTweetsUntilID -@
                                            LilynHana -id 9342084 -@ Soleil -id
                                            89734
  bin.js trackUser [at] [msRefresh]         Tracks a user's profile and prints
                                            when there's a tweet posted.

Options:
  --version      Show version number                                   [boolean]
  --path         The file path of your chrome browser!
     [string] [default: "C:/Program Files/Google/Chrome/Application/chrome.exe"]
  --filepath     The file path to write the results on! Note: Needs full file
                 path!                                                  [string]
  --headless     If puppeteer would show the window it's working on.
                                                       [boolean] [default: true]
  --concurrency  How much tabs puppeteer opens in a run.   [number] [default: 3]
  --help         Show help                                             [boolean]

Not enough non-option arguments: got 0, need at least 1

Feel free to send feature requests & issues in the Issues tab.

If you want to ask me about stuff, send me a DM at Discord: Alice_#5945.

Note:

Latest Update: 1.2.0:

  • [X] Image & Video Parsing in Twitter Posts
  • [X] Live Tracking
    • Check the Twitter user periodically if they posted something new!
  • [X] Major Performance Boost:
    • 20s-30s~ load times to 7-8s~ load times (for 8 users)
  • [X] New cache for Puppeteer
    • faster loading times of twitter.com when warmed up
  • [X] Bluebird promise handling (only available in CLI, you'd need to implement this yourself in TS)
    • better concurrency
    • new concurrency option is added to determine how many tabs puppeteer will handle in one go
  • [X] Minor bug-fixes:
    • changed resolution values (for twitter scrolling to work)

1.0.0 is broken, don't download it. Go with 1.0.1.

Ctrl + Shift + V to preview markdown in VSCode. Not related but.. I need a reminder here.