Socket
Socket
Sign inDemoInstall

cartoon-catch

Package Overview
Dependencies
21
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cartoon-catch

cartoon-catch


Version published
Maintainers
1
Install size
1.70 MB
Created

Readme

Source

漫画爬虫

可以爬虫90%的漫画网站,不支持可以提供网址给作者,作者更新代码。

如不懂使用,可查看例子

实例

// import grab from 'cartoon-catch'; // ts
const {default: grab} = require('cartoon-catch') // js
const options = {
	name: '../漫画名‘,
	host: 'http://xx.com',
	target: '.list a'
}

grab('http://xx.com/m12345', options, function(html, url, title){
	const img = html.match(/https:\/\/img.xxx.com.*\d+.jpg/g)
	const title = html.match(/\<strong\>(.*.)\<\/strong\>/);
	return [imgs, title]
})

options 参数

参数名是否必填类型备注
name../鬼灭之刃string指定下载路径
target.list astring跳转到详情的dom
hosthttp://xxx.comstring设置详情页host, 默认使用页面host
slice[0, 2]array指定数组返回选定的元素
imageHosthttp://cdn.xxx.comstring图片地址的host,如无就无需传
encodingtrueboolean请求返回值乱码时传false
headers{}object自定义头部
urlReplace['1.htm', '{index}']arrayurl替换
titleReplace['鬼灭之刃', '鬼灭']arraytitle替换
beforeFunctionfunction([url, title]){}function自定义爬取方式
downloadOptions{}object设置下载图片参数

downloadOptions 参数

参数名是否必填类型备注
extractjpgstring下载图片后缀,默认jpg
parallel5number并行下载,默认5
timeout5000number请求超时时间,默认5000
gainInterval3000number重试时间,默认3000
againTimes0number重试次数,默认无限次

其他

  • 如果需要DEBUG,环境变量传入DEBUG=debug
  • 支持爬虫网站如下
网址
https://www.manhuaren.com
http://mangabz.com
https://www.soman.com
https://m.kuaikanmanhua.com
https://www.77mh.cc
http://m.pufei.org
http://m.ikkdm.com
https://www.kanbl.cc
https://m.36mh.com/
https://m.kuaikanmanhua.com/
http://www.qiman6.com
...

Keywords

FAQs

Last updated on 09 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc