{"id":16360416,"url":"https://github.com/seanhamlin/nzflagapi","last_synced_at":"2025-12-31T23:30:27.556Z","repository":{"id":35177612,"uuid":"39435141","full_name":"seanhamlin/nzflagapi","owner":"seanhamlin","description":"From https://www.govt.nz/browse/engaging-with-government/the-nz-flag-your-chance-to-decide/gallery/","archived":false,"fork":false,"pushed_at":"2015-07-21T21:41:40.000Z","size":1737,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-29T17:45:46.312Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seanhamlin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-21T08:59:13.000Z","updated_at":"2016-10-04T21:31:46.000Z","dependencies_parsed_at":"2022-07-13T21:43:59.903Z","dependency_job_id":null,"html_url":"https://github.com/seanhamlin/nzflagapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhamlin%2Fnzflagapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhamlin%2Fnzflagapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhamlin%2Fnzflagapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhamlin%2Fnzflagapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanhamlin","download_url":"https://codeload.github.com/seanhamlin/nzflagapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239727065,"owners_count":19687097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T02:11:24.203Z","updated_at":"2025-12-31T23:30:22.098Z","avatar_url":"https://github.com/seanhamlin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NZ Flag API\n\nSo I wanted to write an application that used the data from the NZ Govt to form my own voting application. It is only currently available in HTML format, so I thought I would fix that. The API is currently a flat JSON file, with as much information as I could extract from the govt.nz website.\n\n## JSON file\n\nThe JSON file with all the flag data can found in the API folder. It is around 3 MB. Good times.\n\n## Want to scrape it yourself\n\nCasperJS is used to scrape the data from the website, luckily the data is fairly well structured on the website, so this was not a challenge.\n\n### Installation of the scraper\n\nFirst you will need to install PhantomJS, the [2.0 release](http://phantomjs.org/download.html) is preferred. If you are running Mac OSX there is a critical bug that effects this, you will need this [fork](https://github.com/eugene1g/phantomjs/releases) in the mean time. Once you have downloaded the binary, symlink this to \u003ccode\u003e/usr/local/bin/phantomjs\u003c/code\u003e.\n\nNext is CasperJS, you can git clone this repo\n\n```\ngit clone https://github.com/n1k0/casperjs.git\ngit checkout phantomjs-2\n```\n\nThen symlink the bin/casperjs script to \u003ccode\u003e/usr/local/bin/casperjs\u003c/code\u003e.\n\nYou can verify this works by running:\n\n```\ncasperjs --version\nphantomjs --version\n```\n\nFrom anywhere (as these should now be on your path).\n\n### Run the scraper\n\n```\ncasperjs flag-collect.js\n```\n\nIt takes a while to page through the 172 pages, so be patient. I removed the image download process, as this resulted in 1 GB of flags being downloaded (the code to do this is just commented out, so it is easy to download them if you want).\n\n## Licence\n\nThe NZ Govt website content is licenced under a Creative Commons Attribution 3.0 licence, the link back to the main website is https://www.govt.nz/browse/engaging-with-government/the-nz-flag-your-chance-to-decide/gallery/ and also each item in the JSON feed has a permalink to it's flag page on the site as well.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanhamlin%2Fnzflagapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanhamlin%2Fnzflagapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanhamlin%2Fnzflagapi/lists"}