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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lixian-cli

v0.1.3

Published

lixian xunlei cli on casperjs

Readme

lixian-cli 迅雷离线命令行工具

NPM version

English Version

一个基于casperjs和phantomjs的nodejs迅雷离线任务模块,包含一个命令行工具

功能:

  • 添加任务
  • 下载任务(命令行)
  • 获得离线下载任务列表

安装

使用 npm 安装:

npm install -g lixian-cli

由于 phantomjs 依赖 FreeType, Fontconfig, linux用户需要安装它们。

sudo apt-get install libfreetype6 fontconfig

命令行工具说明

lixian-cli [OPTIONS] <command> [ARGS]

使用示例

$ lixian-cli login -u un -p pw

$ lixian-cli show

$ lixian-cli add 'http://example.com/favicon.ico'

$ lixian-cli download 0 ~/Downloads/

可选命令:

add, download, fetch, login, show

lixian-cli login -u USERNAME -p PASSWORD

登录,并获取任务列表。(任务列表不输出)

lixian-cli fetch [-u USERNAME -p PASSWORD]

更新离线下载任务列表,保存到本地缓存,并输出到命令行。

需要先登录 或者在命令中包含用户名和密码参数以登录

lixian-cli show

显示离线下载任务列表。这个命令不会连接服务器,只显示本地缓存。

lixian-cli download [index] [destination path]

下载指定序号对应的文件。序号的格式应该和 showfetch 命令中输出的一致。

序号可能包含2部分,用-分开 index contains 2 part.

对于单个文件的任务,序号应该为一个数字 对于多个文件的任务,序号应该类似 0-1,用 - 分开

path 不应包含文件名,lixian-cli使用任务内文件的文件名作为下载后文件的文件名

需要先登录 如果距离上次成功登录或更新时间较长,可能会下载失败,需要重新登录。

lixian-cli add [url] [-u USERNAME -p PASSWORD]

添加新任务。支持magnet:, ed2k://, http(s):// url, or thunder://,不支持上传种子文件(推荐使用磁力链接代替)

需要先登录 或者在命令中包含用户名和密码参数以登录

选项:

-P, --page [NUMBER]    Page of lixian tasks (Default is 1)
-u, --username STRING  Username
-p, --password STRING  Password
-n, --tasknum [NUMBER] Tasks per page in \[30, 50, 80, 100\] (Default is 30)
-k, --no-color         Omit color from output
    --debug            Show debug information
-v, --version          Display the current version
-h, --help             Display help and usage details

工作原理

工具使用 casperjs 命令行浏览器,模拟用户实际操作。

casperjs对内存的占用较大,不适合嵌入式设备使用(树莓派等硬件资源强大的除外)

模块 api

加载模块:

lixianTask = require('lixian-cli')

方法

fetch(options)

返回 promise 对象

用法示例:

lixianTask = require('lixian-cli')
promise = lixianTask.fetch({
  page      : 1,
  tasknum   : 30,
  username  : 'un',
  password  : 'pw',
  url       : 'http://example.com/favicon.ico'
})

promise.then(function(json){
  // 得到json文件

  // json文件内容
  json: {
    referer:'url',      //迅雷任务页地址,用于http header
    cookies:'string',   //cookie字符串,用于http header
    tasks: [
      {
        type:'file',    //单一文件
        url: 'url'      //下载地址
        name:'string'   //文件名
      },
      {
        type:'folder',  //文件夹可能包含多个文件
        files:[
          {
            url: 'url'   //下载地址
            name:'string'//文件名
          }
        ]
      }
    ]
  }
},function(err){
  // 错误处理

  //错误对象内容
  err: {
    error:  'object' //命令行返回的异常对象
    stderr: 'string' //casperjs的错误输出
    stdout: 'string' //casperjs的输出
  }
})

add(url, options)

add(url, options)

和在fetch的options中包含url参数的效果一致

login(username, password, options)

login(username, password, options)

和在fetch的options中包含用户名和密码参数的效果一致