Skip to content

Instantly share code, notes, and snippets.

@stefansundin
Created August 10, 2016 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save stefansundin/84d6fe03d0749b1343464f1f7fa9f3c2 to your computer and use it in GitHub Desktop.
Save stefansundin/84d6fe03d0749b1343464f1f7fa9f3c2 to your computer and use it in GitHub Desktop.
Export data from google-code-archive.
#!/usr/bin/env ruby
# https://code.google.com/archive/schema
# https://storage.googleapis.com/google-code-archive/v2/code.google.com/altdrag/project.json
require "httparty"
class CodeParty
include HTTParty
base_uri "https://storage.googleapis.com/google-code-archive/v2/code.google.com"
format :json
def self.get_all_pages(project, type)
entries = []
page = 1
while true
r = get "/#{project}/#{type}-page-#{page}.json"
break if r.code == 404
entries = entries + r.parsed_response["downloads"]
break if r.parsed_response["pageNumber"] == r.parsed_response["totalPages"]
page += 1
end
entries
end
end
# r = CodeParty.get("/altdrag/downloads-page-1.json")
# r = CodeParty.get("/altdrag/project.json")
# puts JSON.pretty_generate(r.parsed_response)
# data = CodeParty.get_all_pages("altdrag", "downloads")
@nnenna23
Copy link

i need help on codes for manet routing protocol comparison

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment