Last active
December 30, 2019 11:30
-
-
Save bilbof/dc41df6dd783668fcf2692c9ac44b917 to your computer and use it in GitHub Desktop.
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
# this script fetches the content items for finders (search UIs) on GOV.UK | |
require 'httparty' | |
def request(url) | |
JSON.parse(HTTParty.get(url).body) | |
end | |
def finders_urls | |
finders = request('https://www.gov.uk/api/search.json?filter_content_store_document_type=finder&count=100&fields=link').dig('results') | |
finders.map { |finder| finder['link'] } | |
end | |
def all_finders | |
finders_urls.map { |url| request('https://gov.uk/api/content' + url) } | |
end | |
all = all_finders | |
all.find { |finder| finder.dig('details', 'nation_applicability') } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment