Export logs from Drafts on geocaching.com

In Tech
Scroll this

This post is also available in: nbNorsk (Norwegian Bokmål)

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

  1. Press F12 when viewing the Drafts page (after scrolling down to load all logs)
  2. 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);
  3. Press Enter, wait ~6 seconds
  4. Select and copy the text
  5. 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 🙂

This post is also available in: nbNorsk (Norwegian Bokmål)

4
Leave a Reply

avatar
2 Comment threads
2 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
thomfrerotlichtChase Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
rotlicht
Guest
rotlicht

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 &”

Chase
Guest
Chase

Where do you paste the code?