Sometimes you may want to export your Drafts (former Field notes) from geocaching.com. I’ve made a quick and dirty script to extract the information, and present it in the same format as in geocache_visits-files.
Prerequisites
- You must use English as your language on geocaching.com
- You must use the new Drafts page, not the old one
- You need to ensure that all logs have been loaded, by scrolling to the bottom until nothing more is loaded
- You need to run a modern browser, like Chrome
This is how you run it
- Press F12 when viewing the Drafts page (after scrolling down to load all logs)
- Paste the following code:
var jq = document.createElement('script');jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(jq); var mt = document.createElement('script');mt.src = "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.2/moment.min.js";document.getElementsByTagName('head')[0].appendChild(mt); setTimeout(function() { $(".draft-content").each(function() { let date = $(this).find(".date"); let time = $(this).find(".timestamp"); let cacheLink = $(this).find("a").attr('href'); let cacheCode = ""; let findDate = ""; let content = ""; let logType = ""; let metaDt = $(this).find(".meta").find("dt"); if(metaDt.length > 1) { logType = metaDt.last().html().replace(':',''); } else { logType = metaDt.first().html().replace(':',''); } cacheCode = cacheLink.substr(cacheLink.indexOf('?gc=') + 4, cacheLink.indexOf('&d=') - cacheLink.indexOf('?gc=') - 4); findDate = moment(date.html() + ' ' + time.html()).format("YYYY-MM-DD") + 'T12:00:00Z'; console.log(cacheCode + ';' + findDate + ';' + logType + ';' + '"' + content + '"'); }); }, 5000);
- Press Enter, wait ~6 seconds
- Select and copy the text
- Paste into notepad (or other text editor), save as geocache_visits.txt
Note: this will not include time or log content, only GC-code, date and log type. But hopefully this is better than nothing 🙂
Should this still be working today (22.12.2018)?
I just tried with Chrome Version 71.0.3578.98 (Offizieller Build) (64-Bit) as described and get the following error in step 3 immediately after pressing Enter: “Uncaught SyntaxError: Unexpected token &”
Sorry, something happened with the code. I have fixed the issue now 🙂
Where do you paste the code?
In the JavaScript Console. Normally opened by pressing F12. Some browsers, like Safari, hides it a bit better.