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

o2o-capture

v0.1.8

Published

o2o capture online page

Downloads

31

Readme

o2o-capture —— online page to offline assets

给线上页面拍照并『复印』到本地。

安装

支持命令行方式和 lib 方式调用。

  1. 安装到全局:

    npm i -g o2o-capture
  2. 安装为依赖包:

    npm i o2o-capture --save
  3. o2o-capture 的依赖

o2o-capture 依赖 phantomjscasperjsawpp@0.4.1+,运行时会自动安装:

npm install -g phantomjs casperjs awpp@latest

使用方法

  1. 命令行方式:

    o2oc -u http://h5.m.taobao.com/market/trip/act/xfzlh5.html -d ./codes

    其中:

    • -u: 指定线上 url;
    • -d: 指定保存到本地的目录

    更多配置项:

    o2o ➤ o2oc --help
       
      Usage: o2oc [options]
         
      Options:
    
        -h, --help             output usage information
        -V, --version          output the version number
        -u, --url <url>        线上页面 url
        -d, --dir <path>       本地目标目录,默认当前工作目录
        -p, --pageDir <path>   页面存放目录,默认 `pages`
        -n, --pageName <name>  页面名,默认从 url 截取
        -i, --imgDir <path>    图片存放目录,默认 `img`
        -j, --jsDir <path>     js 存放目录,默认 `js`
        -c, --cssDir <path>    css 存放目录,默认 `css`
        -e, --pageExt <path>   页面后缀名,默认 `html`
        -h, --handleCss        是否处理 css 中的图片引用
        -r, --removeComment    是否移除页面中的注释,默认 `true`
        -a, --aplusHack        是否 hack 处理 aplus 埋点,默认 `false`
        -w, --waitPageLoadTime <number> 等待页面加载时间(秒),默认 `5`
        -o, --override         是否覆盖目标路径已有页面
  2. lib 方式调用:

    var o2o = require('o2o-capture');
    o2o('http://h5.m.taobao.com/market/trip/act/xfzlh5.html', {
        dir: './test',            // 加载到本地目录
        pageName: 'xfzlh5',       // 页面名
    	pageDir: 'pages',         // 页面存放目录
    	pageExt: 'html',          // 页面后缀
    	jsDir: 'js',              // js 存放目录
    	cssDir: 'css',            // css 存放目录
    	handleCss: false,         // 是否处理 css 中的图片路径
    	removeComment: true,      // 是否移除页面中的注释
    	aplusHack: true,          // 是否 hack 处理 aplus 埋点
    	waitPageLoadTime: 10,     // 等待页面加载时间
    	ignoreAssets: [],         // 需要忽略处理的资源路径
        preserveSelectors: [],    // DOM 中需要保留为源码的 DOM 节点 selector
        removeSelectors: [],      // DOM 中需要移除的源码的 DOM 节点 selector
        userAgentMap: {},         // userAgent 映射表,对 PC 和无线页面区分
        override: true            // 是否覆盖之前生成的页面
    }/*, console*/);

版本历史

  • [0.1.0-0.1.3]
    • init version
  • [0.1.4]
    • Bufix for awpp path
  • [0.1.6]
    • 修复 url 后缀与 pageExt 不一致时,保存两份不同后缀的文件
  • [0.1.7]
    • 加入 options.preserveSelectorsoptions.removeSelectorsoptions.userAgentMapoptions.override 等配置项
  • [0.1.8]
    • fix for request 302 https redirect.