Created
August 11, 2015 18:58
-
-
Save rolandobrown/59ab8241ac1f482b8640 to your computer and use it in GitHub Desktop.
Ruby Final Projects (CLI-Group 12)
This file contains hidden or 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
# require 'net/http' | |
require_relative "./key.rb" | |
require 'rest-client' | |
# require 'pry' | |
nytimes_today_json = RestClient.get("http://api.nytimes.com/svc/search/v2/articlesearch.json?callback=svc_search_v2_articlesearch&q=love&begin_date=20150811&end_date=20150811&hl=true&api-key=#{NYT}") | |
today_parsed = JSON.parse(nytimes_today_json) | |
# nytimes_20140811_json = RestClient.get("http://api.nytimes.com/svc/search/v2/articlesearch.json?callback=svc_search_v2_articlesearch&q=love&begin_date=20140811&end_date=20150811&hl=true&api-key=$NYT") | |
# 20140811_parsed = JSON.parse(nytimes_20140811_json) | |
# | |
# nytimes_20040811_json = RestClient.get("http://api.nytimes.com/svc/search/v2/articlesearch.json?callback=svc_search_v2_articlesearch&q=love&begin_date=20040811&end_date=20150811&hl=true&api-key=$NYT") | |
# 20040811_parsed = JSON.parse(nytimes_20040811_json) | |
json_parsed = today_parsed["response"]["docs"].each do |number| | |
number = 0 | |
final_json_parsed = json_parsed + ["#{number}"]["headline"]["main"] | |
final_json_parsed | |
number+=1 | |
end | |
# binding.pry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment