cartoon-catch

漫画爬虫,可爬取90%的漫画网

Downloads
16
Stars
3
Committers
1

漫画爬虫

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

如不懂使用,可查看例子

实例

const grab = require('cartoon-catch');
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 参数

参数名 是否必填 类型 备注
host http://xxx.com string 网站域名
name ../鬼灭之刃 string 指定下载路径
target .list a string 跳转到详情的dom
imageHost http://cdn.xxx.com string 图片地址的host,如无就无需传
encoding true boolean 请求返回值乱码时传false
headers {} object 自定义头部
urlReplace ['1.htm', '{index}'] array url替换
titleReplace ['鬼灭之刃', '鬼灭'] array title替换
beforeFunction function([url, title]){} function 自定义爬取方式
downloadOptions {} object 设置下载图片参数

downloadOptions 参数

参数名 是否必填 类型 备注
extract jpg string 下载图片后缀,默认jpg
parallel 5 number 并行下载,默认5
timeout 5000 number 请求超时时间,默认5000
gainInterval 3000 number 重试时间,默认3000
againTimes 0 number 重试次数,默认无限次

其他

  • 如果需要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
...
Package Rankings
Top 16.62% on Npmjs.org
Related Projects