Last active
September 7, 2017 21:19
-
-
Save Coder2012/cae91bc61329039cbd396fe73f23fdec to your computer and use it in GitHub Desktop.
XC League
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
curl "http://www.xcleague.com/xc/download.php?pilot=1&output=IGC&year=2008&xcFlightId=2008[1-100]" -o "#1.igc" | |
const puppeteer = require('puppeteer'); | |
const url = 'http://www.gpsvisualizer.com/map_input?form=google'; | |
(async() => { | |
const browser = await puppeteer.launch({headless: false}); | |
const page = await browser.newPage(); | |
page.setViewport({ | |
width: 1400, | |
height: 800 | |
}) | |
await page.goto(url, {waitUntil: 'networkidle'}); | |
//input:uploaded_file_1 | |
const form = await page.$('form'); | |
async function setSelectVal(sel, val) { | |
page.evaluate((data) => { | |
return document.querySelector(data.sel).value = data.val | |
}, {sel, val}) | |
} | |
await setSelectVal('[name=trk_colorize]', 'altitude'); | |
const check = await page.$('#new_window_checkbox'); | |
await check.click(); | |
const input = await page.$('input[name=uploaded_file_1]'); | |
await input.uploadFile('2017/2479.igc'); | |
await form.evaluate(form => form.submit()); | |
const link = await page.$("a[href^='/display']"); | |
console.log(link) | |
await link.click(); | |
console.log('form submit'); | |
//browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment