page-fucker
v1.0.1
Published
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![npm bundle size (minified + gzip)][bundlesize-image]][bundlesize-url]
Downloads
10
Readme
Page Fucker
Page-fucker is a toy allows you to easily fuck all the web pages if you want.
Install
npm i page-fucker
Usage
This tool is very easy to use, just see the code:
import { PageFucker } from 'page-fucker'
new PageFucker({
url: 'http://www.ceic.ac.cn/ajax/speedsearch?num=1&&page=1&&callback=xxx',
//regex: /(data=eval\(')(.*)('\);)/g,
interval: 1000 * 60,
regex: /(xxx\()(.*)(\))/g,
complete: (data) => {
console.log('ok')
console.log(data)
},
success: (result) => {
// 自己玩 ,上面的正则分了 3组,用中间的即可
console.log(Date.now(), JSON.parse(result[2]))
},
});
new PageFucker({
url: 'https://www.dahuatech.com/about/join.html?keyword=&department=%E7%A0%94%E5%8F%91%E4%B8%AD%E5%BF%83&place=%E6%9D%AD%E5%B7%9E',
type: 'html',
interval: 1000 * 30,
complete: (data) => {
console.log('get dahua job list')
},
success: ($) => {
let jobs = []
$('.join-box ul li').each((i, li) => {
let $li = $(li)
jobs.push({
title: $(li).find('.tit p:eq(0)').text().trim(),
address: $(li).find('.tit p:eq(2)').text().trim(),
date: $(li).find('.tit p:eq(3)').text().trim(),
detail: $(li).find('.in .bot p').text().trim(),
})
})
console.log(jobs)
},
})
API
// stop
let xxx = new PageFucker({})
xxx.stop()