https://github.com/mediacomem/ipgeolocation
Geolocate IP addresses from a CSV file with https://ipgeolocation.io
https://github.com/mediacomem/ipgeolocation
Last synced: about 1 year ago
JSON representation
Geolocate IP addresses from a CSV file with https://ipgeolocation.io
- Host: GitHub
- URL: https://github.com/mediacomem/ipgeolocation
- Owner: MediaComem
- License: mit
- Created: 2020-03-30T15:49:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-22T11:18:24.000Z (over 4 years ago)
- Last Synced: 2025-02-14T17:43:25.617Z (over 1 year ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ipgeolocation
> Get the geolocation of IP addresses in a CSV file using
> https://ipgeolocation.io.
This tool expects a CSV file with IP addresses in the first column and a
one-line header, for example:
```csv
IP Address,Whatever
100.101.102.103,foo
104.105.106.107,bar
200.201.202.203,baz
```
It will output a CSV file with geolocation data about each IP address. This is a
simplified example of the output:
```csv
ip,type,result,country_code2,country_name,state_prov,city,...
100.101.102.103,ipv4,success,US,United States,New York,Syracuse,...
104.105.106.107,ipv4,success,US,United States,Wisconsin,Canton,...
200.201.202.203,ipv4,success,US,United States,Colorado,Denver,...
```
The description of all returned geolocation data can be found here:
https://ipgeolocation.io/documentation/ip-geolocation-api.html
**NOTE: you need a (free) [ipgeolocation](https://ipgeolocation.io) account and API key.**
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Examples](#examples)
## Requirements
* [Node.js](https://nodejs.org) 12+
## Installation
```bash
npm install --global @mediacomem/ipgeolocation
```
> Or with [npx](https://github.com/npm/npx#readme):
>
> ```bash
> npx @mediacomem/ipgeolocation --help
> ```
## Usage
```
ipgeolocation [options...]
Options:
--version Show version number [boolean]
--apiKey, -k, --api-key Provide your ipgeolocation API key[string] [required]
--apiUrl, -u, --api-url Change the default ipgeolocation API URL
[string] [default: "https://api.ipgeolocation.io/ipgeo"]
--input, -i CSV input file (- for standard input)
[string] [default: "-"]
--output, -o CSV output file (standard output if not specified)
[string]
--help Show help [boolean]
```
## Examples
* Geolocate IP addresses in a CSV file and save the results to another file:
ipgeolocation -i input.csv -o output.csv --api-key CHANGEME
* Geolocate IP adresses in CSV from standard input and print the results to
standard output:
cat input.csv | ipgeolocation --api-key CHANGEME > output.csv