GithubHelp home page GithubHelp logo

ourongxing / web-printer Goto Github PK

View Code? Open in Web Editor NEW
92.0 92.0 10.0 1.6 MB

A printer that can print multiple web pages as one pretty PDF

License: MIT License

TypeScript 94.77% JavaScript 5.23%
pdf printer typescript

web-printer's Introduction

web-printer's People

Contributors

ourongxing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

web-printer's Issues

引入 zhihu 的包,报 TypeError: zhihu is not a function

按照 README 中的案例来运行的

import { Printer } from "@web-printer/core"
import zhihu from "@web-printer/zhihu"

new Printer()
  .use(
    zhihu({
      url: "https://www.zhihu.com/collection/19561986"
    })
  )
  .print("值得回头看几遍")

console.log(zhihu) 输出如下

{ default: [Getter] }

所以代码修改成如下可以运行了

- zhihu({
+ zhihu.defalt({

运行 pnpm print 后无输出,如何排查原因呢

hi,我做了两次尝试,第一次使用 vitepres 插件,第二次使用阮一峰插件,其他设置都采用默认的设置
运行 pnpm print 后,日志为

Fetching Pages Info...(node:92391) UnhandledPromiseRejectionWarning
(Use node --trace-warnings ... to show where the warning was created)
(node:92391) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:92391) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

userData 内容为空,无 pdf 生成。请问原因可能是什么呢?

生成的 pdf 中的答案内容是知乎的登录页面

目前安装了 Chrome 浏览器,Chrome 浏览器已经登录了知乎,生成的 PDF 中有的答案是正常的内容,有的答案都是 知乎的登录页面,显示知乎的登录页面
测试爬取的知乎专栏为 https://www.zhihu.com/collection/20328337

image

目前看是爬取的目录是重复的,爬取到了整个专栏的数量,但是因为 没有设置 maxPages,导致一直重复爬取的第一页的数据,然后不断重复爬取第一页知道数量达到整个专栏的文章总数量
image

爬取到后面,出现了知乎的检测

image

执行 tsx index.ts 报错

报错信息:
Fetching Pages Info...node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^

Protocol error (Browser.setDownloadBehavior): 'Browser.setDownloadBehavior' wasn't found

node: 18.12
chrome: 最新版

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.