Skip to content

Instantly share code, notes, and snippets.

@fflorent
Last active November 1, 2017 17:57
Show Gist options
  • Save fflorent/b469b18776b1a9f682ea9d3addae399a to your computer and use it in GitHub Desktop.
Save fflorent/b469b18776b1a9f682ea9d3addae399a to your computer and use it in GitHub Desktop.
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