2020-12-17 00:32:05 -06:00
2020-12-09 12:03:20 +01:00
2020-12-11 10:18:23 +01:00
2020-12-17 00:32:05 -06:00

Instagram Location Search

Prerequisites

This Python application requires requests, numpy, and pandas to be properly installed. This can be done with pip3 install requests numpy pandas.

Example usage

The following command will search for Instagram locations nearby the coordinates 32.22 N, 110.97 W (downtown Tucson, Arizona.) The list of locations is saved as a CSV file at "locs.csv".

python3 instagram-locations.py --session "<session-id-token>" --lat 32.22 --lng -110.97 --csv locs.csv

Note that this requires an Instagram session ID in order to work! See below for how to obtain one from your account.

Other output formats

Using the --json <output-location> command line argument, the list can be saved as a JSON file, almost identical to the raw API response.

Using the --geojson <output-location> command line argument, the list can be saved as a GeoJSON file for other geospatial applications.

Using the --map <output-location> command line argument, a simple Leaflet map is made to visualize the locations of the returned points.

Example of map visualization

Multiple types of output can be generated. For example, the following command will search for Instagram locations, save the JSON list, a CSV file, and a map for viewing the locations visually.

python3 instagram-locations.py --session "3888090946%3AhdKd2fA8d72dqD%3A16" --lat 32.22 --lng -110.97 --json locs.json --csv locs.csv --map map.html

Getting an Instagram session ID

Important: an Instagram session ID should be treated like a password — it provides full access to the Instagram account. Using this session ID in multiple places or on multiple computers may trigger Instagram to invalidate all session IDs. Using this session ID for any purpose other than the official Instagram website or application may be a violation of the Instagram Terms of Service and could lead to account suspension.

  1. In Google Chrome, log-in to Instagram.
  2. Right click on the page and press "Inspect" to bring up the Chrome Developer Tools.
  3. Click the "Application" tab in the Developer Tools Box.
  4. Under "Cookies" select "https://www.instagram.com."
  5. The value next to "sessionid" is your Instagram session ID.

Finding the Instagram cookie

Description
Finds Instagram location IDs near a specified latitude and longitude.
Readme MIT 3.3 MiB
Languages
Python 95.7%
Shell 4.3%