Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
osm-revert-scripts/download_changesets.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
37 lines (29 sloc)
869 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # script to download all changesets of one user since | |
| # a given date (to get ALL, set date to before their signup) | |
| # API currently limited to listing max. 100 changesets, | |
| # therefore loop required | |
| USER=someuser | |
| SINCE=2013-11-01T00:00:00 | |
| # no user servicable parts below. run this in empty directory | |
| # and you'll end up with tons of files called c1234.osc (one | |
| # for each changeset) | |
| T=`date -u +%Y-%m-%dT%H:%M:%S` | |
| export T | |
| while true | |
| do | |
| wget -Olist "https://api.openstreetmap.org/api/0.6/changesets?display_name=$USER&time=$SINCE,$T" | |
| T=`grep "<changeset" list | tail -1 | cut -d\" -f4` | |
| if grep -q "<changeset" list | |
| then | |
| cat list | grep "<changeset" | cut -d\" -f2 | while read id | |
| do | |
| rm -f list | |
| [ -f c$id.osc ] && exit | |
| wget -Oc$id.osc https://api.openstreetmap.org/api/0.6/changeset/$id/download | |
| done | |
| else | |
| rm -f list | |
| exit | |
| fi | |
| done |