An Instagram OSINT tool to collect all the geotagged locations available on an Instagram profile in order to plot them on a map, and dump them in a JSON.
TL;DR : ascineema, video of the project
A tool to scrape geotagged locations on Instagram profiles. Output in JSON & interactive map.
sudo apt install chromium-chromedriver && chmod a+x /usr/bin/chromedriver
git clone https://github.com/bernsteining/instaloctrack
cd instaloctrack
pip3 install .
Or use Docker:
sudo docker build -t instaloctrack -f Dockerfile .
instaloctrack -h
usage: instaloctrack [-h] [-t TARGET_ACCOUNT] [-l LOGIN] [-p PASSWORD] [-v]
Instagram location data gathering tool. Usage: python3 instaloctrack.py -t <target_account>
optional arguments:
-h, --help show this help message and exit
-t TARGET_ACCOUNT, --target TARGET_ACCOUNT
Instagram profile to investigate
-l LOGIN, --login LOGIN
Instagram profile to connect to, in order to access
the instagram posts of the target account
-p PASSWORD, --password PASSWORD
Password of the Instagram profile to connect to
-v, --visual Spawns Chromium GUI, otherwise Chromium is headless
e.g.
instaloctrack -t <target_account>
If the target profile is private and you have an account following the target profile you can scrape the data with a connected session:
instaloctrack -t <target_account> -l <your_account> -p <your_password>
or with Docker:
sudo docker run -v /tmp/output:/tmp/output instaloctrack -t <target_account> -o /tmp/output
First, we retrieve all the pictures links of the account by scrolling the whole Instagram profile, thanks to seleniumās webdriver.
Then, we retrieve asynchronously (asyncio) each picture link, we check if it contains a location in the picture description, and retrieve the locationās data if thereās one, and the timestamp.
Because Instagram doesnāt provide GPS coordinates, and weāre only given names of places, we have to geocode these (.ie. get the GPS coords from the nameās place).
For this, I used Nominatimās awesome API, which uses OpenStreetMap. For our usage, no API key is required, and we respect Nominatimās usage Policy by requesting GPS coordinatess once every second.
Eventually, once we have all the GPS coordinatess, we generate a HTML (thanks to jinja2 templating) with Javascript embedded that plots an Open Street Map (thanks to Leaflet library) with all our locations pinned. Once again, no API key is required for this step.
Also, the data collected by the script (location names, timestamps, GPS coordinates, errors) are dumped to a JSON file in order to be re-used.
As an example, hereās the output on the former French Presidentās Instagram profile, @fhollande:
The Heatmap:
Information available when clicking on a marker:
Stats about the location data:
The JSON data dump (just a part of it to show the format for a given location):
{
"link": "https://www.instagram.com/p/-Q_9EvR9eu",
"place": {
"id": "290297",
"name": "MusƩe du quai Branly - Jacques Chirac",
"slug": "musee-du-quai-branly-jacques-chirac",
"street_address": " 37 quai Branly",
" zip_code": " 75007",
" city_name": " Paris",
" region_name": " ",
" country_code": " FR"
},
"timestamp": "2015-11-19",
"gps": {
"lat": "48.8566969",
"lon": "2.3514616"
}
}