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 🙏

© 2026 – Pkg Stats / Ryan Hefner

weibo-crawler

v0.1.3

Published

A weibo crawler

Readme

Weibo Crawler / 微博爬虫

A simple weibo crawler

Features

  • Crawl all the weibos of a user.

Result

http://weibo.com/p/1005051736338681/home?from=page_100505_profile&wvr=6&mod=data#place

[
  {
    "scheme": "http://m.weibo.cn/status/EquqEyH0v?mblogid=EquqEyH0v&luicode=10000011&lfid=1076031736338681",
    "createdAt": "01-12 16:38",
    "id": "4063135008268475",
    "text": "想玩物丧志,请问玩什么物能比较轻松愉快无负担地丧志 ​​​",
    "repostsCount": 3,
    "commentsCount": 47,
    "likesCount": 59
  },
  {
    "scheme": "http://m.weibo.cn/status/EpMbwy2dU?mblogid=EpMbwy2dU&luicode=10000011&lfid=1076031736338681",
    "createdAt": "01-08 00:00",
    "id": "4061434268111702",
    "text": "分享图片 ​​​",
    "repostsCount": 5,
    "commentsCount": 7,
    "likesCount": 71,
    "pics": [
      "http://wx4.sinaimg.cn/orj360/677e6cf9ly1fbiie692r0j20ku09ywg7.jpg",
      "http://wx3.sinaimg.cn/orj360/677e6cf9ly1fbiie60h1nj20ku0a9ab9.jpg",
      "http://wx2.sinaimg.cn/orj360/677e6cf9ly1fbiie6hl5aj20ku04pdgb.jpg"
    ]
  },
  {
    "scheme": "http://m.weibo.cn/status/EpLXkAI8Q?mblogid=EpLXkAI8Q&luicode=10000011&lfid=1076031736338681",
    "createdAt": "01-07 23:25",
    "id": "4061425468749492",
    "text": "Repost",
    "repostsCount": 14,
    "commentsCount": 3,
    "likesCount": 29,
    "retweetedStatus": {
      "id": "4061419093386276",
      "text": "如果你讨厌文青,那这是一个好时代。我们有能者多劳的大大,有始终关怀引导年轻人文化思想的团团。文艺行业腊月十八,而你的孩子,再也不用看那些把文青们脑子弄乱的东西了。 ​​​",
      "userName": "alitha",
      "userId": 3171360847
    },
    {
      "...": "...."
    }
]

Quick Start

git clone https://github.com/fytriht/weibo-crawler.git
cd weibo-crawler
npm install
npm run test

Basic usage

Installing

npm i weibo-crawler

Get URL & Start crawling

screenshot1

  • Go to the user's home page which you want to crawl
  • Click "他/她的主页" button
  • Copy the URL
const weiboCrawler = require('weibo-crawler')

const url = 'http://weibo.com/p/1005051736338681/home?from=page_100505_profile&wvr=6&mod=data#place'

weiboCrawler(url)
  .then(data => {
    console.log(JSON.stringify(data, null, 2))

    /*
     * or you can, for example:
     *
     * const fs = require('fs')
     *
     * fs.writeFile('data.json', JSON.stringify(data, null, 2), (err) => {
     *   if (err) return err
     * })
     * 
     */
  })
  .catch(err => console.error('Something went wrong.'))

You can also set the concurrency:

...
weiboCrawler(url, concurrency) // concurrency defaulting to 5
...

Limitation

  • Due to Sina Weibo's anti-crawling strategy, the default concurrency is recommended. If the concurrency is too high, you might get an error similar to the following. Just wait a few more minutes and try again.
node index.js

undefined:1
<!DOCTYPE html>
^

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at superagent.get.end (/*****************************/node_modules/weibo-crawler/getApiUrls.js:21:32)
    at Request.callback (/*****************************/node_modules/superagent/lib/node/index.js:672:3)
    at Stream.<anonymous> (/*****************************/node_modules/superagent/lib/node/index.js:866:18)
    at emitNone (events.js:86:13)
    at Stream.emit (events.js:185:7)
    at Unzip.<anonymous> (/*****************************/node_modules/superagent/lib/node/unzip.js:53:12)
    at emitNone (events.js:91:20)
    at Unzip.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
  • If the user have a lot of weibos(3000+), you might get an unexpected result. I am working on this issue.

TODO

  • [x] test cases
  • [ ] error handling
  • [x] unescaped text content

Support

If you have any problem or suggestion please open an issue here