DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

Bulk Log Downloader for AirData

Kazzaaz

Well-Known Member
Joined
Nov 11, 2018
Messages
125
Reactions
105
Age
27
I had a few hundred flights logged in AirData and wanted to collect each KML, CSV, and original .TXT log for several reasons.

So I wanted to share this dumb function to download all of your flights without having to open each one.

I tested this in Firefox.
Log into AirData, press F12 to open the JavaScript console, and paste the following code.
If you want the script to automatically delete the downloaded flights in order to reach the archived ones, change the first line to var deleteOld = true;

Code:
var deleteOld = false;

var myMap = flightNavigation.findAllRowsByKeyAndValue().slice(1);
function downloadFlight(i){
    if(i >= myMap.length){
        if(deleteOld){
            selectAllFilesInPage();
            new BulkOperation("bulk_delete", selectedFlights).callBulkOperation({action: "bulk_delete"});
        }
        return;
    }
    var logHash = myMap[i].data().h;
    new Promise(function(res, rej){
        setTimeout(function(){
            window.open("https://app.airdata.com/csv?flight=".concat(logHash));
            res();
        }, 300);
    }).then(function (){
        new Promise(function(res, rej){
        setTimeout(function(){
            window.open("https://app.airdata.com/kml?flight=".concat(logHash));
            res();
        }, 300);
        }).then(function (){
                new Promise(function(res, rej){
            setTimeout(function(){
                window.open("https://app.airdata.com/original?flight=".concat(logHash));
                res();
            }, 300);
            }).then(function (){
                if(i==28 && deleteOld){
                    selectAllFilesInPage();
                    new BulkOperation("bulk_delete", selectedFlights).callBulkOperation({action: "bulk_delete"});
                    myMap = myMap.slice(29);
                    downloadFlight(0);
                }
                else if(i<99) downloadFlight(i+1);
            })
        })
    });
}
downloadFlight(0);
}

...and press Enter. Go do something else while Firefox takes a dump on your CPU.


1565505564572.png



IMPORTANT: you will get a million download windows you'll have to click OK on unless you do the following:
- open your Firefox settings and click the General tab
- scroll down until you see the "Files and Applications" section
- make sure a download location is set, and the KML/CSV/TXT file extensions are set to "Save File"

My 800+ flight records are now safe and sound... :)
Enjoy!
 
Last edited:
Has anyone tried running this lateley?

I am not a programmer, and I am getting this error:

var deleteOld = false;

var myMap = flightNavigation.findAllRowsByKeyAndValue().slice(1);
function downloadFlight(i){
if(i >= myMap.length){…

Uncaught SyntaxError: expected expression, got '}'

debugger eval code:42:17
 
Has anyone tried running this lateley?

I am not a programmer, and I am getting this error:

var deleteOld = false;

var myMap = flightNavigation.findAllRowsByKeyAndValue().slice(1);
function downloadFlight(i){
if(i >= myMap.length){…

Uncaught SyntaxError: expected expression, got '}'

debugger eval code:42:17
Hi!
For some reason there is a bracket at the end that should be removed. This forum won't let me edit my original post.

Just copy everything up until the very last "{" and it should work.
 
Hi!
For some reason there is a bracket at the end that should be removed. This forum won't let me edit my original post.

Just copy everything up until the very last "{" and it should work.
Uncaught ReferenceError: flightNavigation is not defined
<anonymous> debugger eval code:3
 
@Kazzaaz let me know when you get this worked out and I can EDIT your original post for you so it's accurate.

Allen
 
Uncaught ReferenceError: flightNavigation is not defined
<anonymous> debugger eval code:3

This would only happen if you are running the script on the wrong page.
Make sure you run this while you are on the LOGS/overview page.
 
Lycus Tech Mavic Air 3 Case

DJI Drone Deals

New Threads

Forum statistics

Threads
130,994
Messages
1,558,710
Members
159,982
Latest member
PetefromNZ