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

idol-grab-utils

v1.1.1

Published

抓取口袋48(聚聚房间/直播录播源信息)/微博/摩点众筹/摩点微打赏 工具集,提供HTTP接口 or Node.js Service

Downloads

9

Readme

idol-grab-utils

npm version

抓取口袋48(聚聚房间/直播录播源信息)/微博/摩点众筹/摩点微打赏 工具集,提供 HTTP 方式访问 or Node.js API

安装

使用 Git 克隆(通过 HTTP 访问):

$ git clone https://github.com/dbFlower/idol-grab-utils.git

使用 NPM 安装(直接使用 API):

$ npm install --save-dev idol-grab-utils

直接下载 zip:

$ wget https://github.com/dbFlower/idol-grab-utils/archive/master.zip

配置基本信息

若未使用 NPM 安装, 请先安装依赖:

$ npm i

开启 HTTP 访问的配置方法

配置 config.js

{
  token: '', // HTTP接口的token, 大小写不敏感。 若直接使用服务或不需要验证token则可留空
  pocket48: {
    // 若不需要使用口袋房间消息功能则可不必配置账号密码
    account: '', // 口袋48手机号
    password: '', // 口袋48密码
  },
  port: 3000, // 开发模式端口,修改生产模式端口请编辑 process.json
  IMEI: '866716037125816', // 用于发请求的IMEI码, 15位, 请不要使用自己手机的IMEI以防被封设备
}

调用 Node.js API 的配置方法

若在服务中需要使用口袋48房间相关api, 请用以下方式配置账号密码:

  const { pocket48 } = require('idol-grab-utils')
  const koudai48 = {
    account: '1xxxxxxxx', // 手机号
    password: 'Your password here',
  }

  Object.assign(pocket48, koudai48)

  // 请不要直接对pocket48进行赋值!

启动

启动 HTTP 服务

调试模式(端口默认为3000):

$ npm start

生产模式(端口默认为4004):

$ npm run pm2

调用 Node.js API

  const { weiboService } = require('idol-grab-utils')
  // ...some code 
  async function fetchWeibo() {
    const data = await weiboService.getWeibo('3050742117') // 用户 UID 即可。
    // ... 分析微博数据
    // ... 判断是否有新微博
    // ... some code 
  }

通过 HTTP 访问

所有的接口都支持 GET/POST 两种请求方式。

token 验证

若开启token验证,则验证每个请求是否携带token。 当前支持三种方式传输token:

在 headers 中发送 token

在 url 中携带 token: ?token=xxxx

在 post 方式请求时将 token 作为 Post Data 发送

TODO

具体文档的坑还未填

HTTP的所有接口都在 routes/index.js 中可以查看

所有Node.js 可以调用的 API 在 services 文件夹中