提交 ef58b335 编写于 作者: 怪力左手's avatar 怪力左手

init

上级 c6969de6
const express = require('express')
const start_grab = require('./lottery')
const app = express()
start_grab()
app.get('/',async function(req,res){
await start_grab()
res.send('Hello World')
})
app.listen(5001,()=>{
process.title='stock scan server';
console.log('id:',process.pid)
})
\ No newline at end of file
const puppeteer = require('puppeteer');
async function start_grab(){
const browser = await puppeteer.launch({headless: true});
const page = await browser.newPage()
//page.goto('http://www.baidu.com/s?wd=彩票')
await page.goto("http://kaijiang.500.com/?0_ala_baidu")
const element = await page.waitForSelector('.kj_tablelist01')
const titles = await element.$$eval('.td_title02',o=>o.map(t=>t.innerText))
const stages = await element.$$eval('.td_title02',o=>o.map(t=>t.nextElementSibling.innerText))
const dates = await element.$$eval('.td_title02',o=>o.map(t=>t.nextElementSibling.nextElementSibling.innerText))
const nums = await element.$$eval('.td_kjhm01 > .ball_box01', o=>o.map(t=>{
return Array.prototype.map.call(t.children[0].children,x=>x.innerText)
}))
let stocks = []
stocks.push()
await element.dispose();
await browser.close()
return element
}
module.exports = start_grab
\ No newline at end of file
{
"name": "stock_scan",
"version": "1.0.0",
"description": "check rest api for custom webservice for every stock in shanghai.get the newest price and information.",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitee.com/sofu456/stock_scan.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2",
"puppeteer": "^19.6.2"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册