Skip to content

Instantly share code, notes, and snippets.

@marguslt
Last active Dec 16, 2021
Embed
What would you like to do?
Scraping Movescount POIs into GPX
let gpx = `<?xml version="1.0" encoding="utf-8"?>
<gpx xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xmlns="http://www.topografix.com/GPX/1/1">
`;
document.querySelectorAll("div.waypoint_item div.fl0.fs0").forEach(poi => {
let descr = poi.querySelector(".columns-header").innerText.trim();
let [poi_match,poi_lat,poi_lon,poi_elev,poi_date,poi_time] = poi.querySelector(".columns-para").innerText.trim().match(/([\d.]+), ([\d.]+) ([\d.]+ m )?([\d.]+) ([\d:]+)/);
let [d_match,d,m,y] = poi_date.match(/(\d+)\.(\d+)\.(\d+)/)
let [t_match,hh,mm] = poi_time.match(/(\d+):(\d+)/);
let poi_datetime = new Date(y,m - 1,d,hh,mm);
let wpt =
` <wpt lat="${poi_lat}" lon="${poi_lon}">
<time>${poi_datetime.toISOString()}</time>
<name>${descr}</name>
</wpt>
`
gpx += wpt;
})
gpx += '</gpx>'
console.log(gpx)
copy(gpx)
// list routes and gpx export links
// works only on a watch page ( https://www.movescount.com/gear/gear18.. )
document.querySelectorAll("#waypointedRoute_items .columns").forEach(route => {
console.log(route.querySelector("div.fl0.fs0 > div.columns-header").innerText.trim())
console.log(`https://www.movescount.com/Move/ExportRoute/${route.getAttribute("data-id")}?format=1`)
})
@marguslt
Copy link
Author

marguslt commented Jan 22, 2021

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment