Last active
November 1, 2017 17:57
-
-
Save fflorent/b469b18776b1a9f682ea9d3addae399a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']}); | |
const page = await browser.newPage(); | |
await page.goto('https://dofusama.fr/treasurehunt/stats/tous-les-indices.html') | |
const href = await page.evaluate(async () => { | |
const link = document.querySelectorAll('table a')[0] | |
return Promise.resolve(link.href); | |
}) | |
await page.goto(href) | |
const source = await page.evaluate(async () => { | |
const source = document.querySelectorAll('iframe')[0].src | |
return Promise.resolve(source); | |
}); | |
const headers = { | |
Referer: "https://dofusama.fr/treasurehunt/stats/details-hache-103.html", | |
} | |
await page.setExtraHTTPHeaders(headers) | |
await page.goto(source) | |
const positions = await page.evaluate(async () => { | |
return Promise.resolve(window.positions); | |
}); | |
await console.log(positions); | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment