Skip to content

Instantly share code, notes, and snippets.

@Coder2012

Coder2012/xcleague.js

Last active Sep 7, 2017
Embed
What would you like to do?
XC League
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
You can’t perform that action at this time.