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

update

上级 ef58b335
......@@ -6,18 +6,30 @@ async function start_grab(){
//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()
let lottery = lottery_new()
await element.dispose();
await browser.close()
return element
return lottery
}
async function lottery_history(){
}
async function lottery_new(){
const nums = await element.$$eval('.td_kjhm01 > .ball_box01', o=>o.map(t=>Array.prototype.map.call(t.children[0].children,x=>x.innerText)))
const titles = await element.$$eval('.td_kjhm01 > .ball_box01',o=>o.map(t=>t.parentElement.previousElementSibling.previousElementSibling.previousElementSibling.innerText))
const stages = await element.$$eval('.td_kjhm01 > .ball_box01',o=>o.map(t=>t.parentElement.previousElementSibling.previousElementSibling.innerText))
const dates = await element.$$eval('.td_kjhm01 > .ball_box01',o=>o.map(t=>t.parentElement.previousElementSibling.innerText))
let lottery = []
for(let i=0;i<titles.length;i++){
lottery.push([])
lottery[i].push(titles[i])
lottery[i].push(stages[i])
lottery[i].push(dates[i])
lottery[i].push(nums[i])
}
return lottery
}
module.exports = start_grab
\ 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()
await page.goto("http://kaijiang.500.com/?0_ala_baidu")
const element = await page.waitForSelector('.kj_tablelist01')
let stock = stock_info()
await element.dispose();
await browser.close()
return stock
}
module.exports = start_grab
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册