项目作者: KonghaYao

项目描述 :
This is a JavaScript toolkit for browser crawler testing.
高级语言: JavaScript
项目地址: git://github.com/KonghaYao/jspider.git
创建时间: 2020-08-29T06:27:13Z
项目社区:https://github.com/KonghaYao/jspider

开源协议:Apache License 2.0

下载


JSpider 3.2 BETA

npm NPM GitHub top language GitHub code size in bytes

JSpider 3 是在 Chrome Devtools 中进行爬虫的爬虫框架,这个框架包括了完整的爬虫支持。如果您具有前端基础,那么可以在三分钟内入门哦!

JSpider 3 is a Chrome DevTools crawler framework that includes full crawler support. If you have a front-end foundation, you can get up and running in three minutes!

  • 高效率工具:JSpider 自带并发控制,提供多种方便的数据处理插件。
  • 爬虫高度复用:JSpider 的代码可以重复使用,随时添加新任务。

官方教程链接

快速入门

自定义爬取

  1. await import('https://cdn.jsdelivr.net/npm/js-spider/dist/JSpider.esm.min.js').then({JSpider}=>{
  2. window.JSpider = JSpider;
  3. });
  4. // 导入插件,JSpider 还有很多功能插件
  5. const {
  6. Request, // 请求库
  7. Download, // 下载库
  8. } = JSpider.plugins;
  9. let urls = ['https://.....']// 您的爬取路径数组
  10. const spider = new JSpider()
  11. spider.pipeline(
  12. Request(),
  13. Plugin((data) => {
  14. data
  15. return data;
  16. }),
  17. Download()
  18. );
  19. spider.crawl(urls);
  20. spider.start();
  21. // 等待下载完成!

!> 更多自定义代码教程

注意事项

1. CORS 和 CSP (Content Security Policy) 协议导致您无法爬取到数据。

CORS 和 CSP 是浏览器的安全策略,与 JSpider 无关,我推荐您遵守。很多网站使用了这两种协议来防止 Javascript 语言在浏览器中为所欲为,所以如果您使用的是 Chrome,可以在 Chrome 插件商店 中搜索 CORS 和 CSP,安装相应的插件即可解除这两个协议的报错。我无法保证这些插件的安全性,所以在此不推荐。

License

自 3.2 版本之后的版本都设置为 Apache-2.0, 3.2 之前版本均为 MIT License

Copyright © KonghaYao Apache-2.0 licensed