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
# TROVE API TEST | |
# Updates April 26th 2017 | |
# | |
# Searches Trove (National Library of Australia) for historical articles matching input town name and search term | |
# Writes results to csv file and then proceeds to read them aloud with the "say_something" method | |
# CHANGES | |
# This version takes the two search terms DIRECT FROM USER | |
# It does not (as in previous versions) require a csv of town names... | |
# The csv concept is likely to be useful in future, but for live-performance purposes it is too time consuming |
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
# TROVE API TEST | |
# Updates April 25th 2017 | |
# Searches Trove (National Library of Australia) for historical articles matching input town name and search term | |
# Writes results to csv file and then proceeds to read them aloud with the "say_something" method | |
# CHANGES | |
# This version takes two search terms DIRECT FROM USER (one should be a town name) | |
# It does not (as in previous versions) require a csv of town names... | |
# Note that the csv is likely to be useful in future, but for live purposes it is too time consuming | |
# The "say_something" method will now work for Mac or Linus |
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
# TROVE API TEST | |
# Updates April 25th 2017 | |
# Searches Trove (National Library of Australia) for historical articles matching input town name and search term | |
# Writes results to csv file and then proceeds to read them aloud with the "say_something" method | |
# CHANGES | |
# This version takes two search terms DIRECT FROM USER (one should be a town name) | |
# It does not (as in previous versions) require a csv of town names... | |
# Note that the csv is likely to be useful in future, but for live purposes it is too time consuming | |
# The "say_something" method will now work for Mac or Linus |
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 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
# April 3rd 2017, 7pm | |
# This version of testing the Open Movie Database API is working well but falls down with large numbers (possibly because the API deliberately throttles our requests after a certain threshold) | |
# This version incorporates feedback from the meeting, indicating that the unusual writer variations (enclosed in parentheses for some writers, e.g. J.R.R. Tolkien has 'based on the novel by') should be kept, but in a separate field... | |
# The other vulnerability is in international characters - it is definitely writing them out in a strange and unusable fashion | |
# BUT this does work: it outputs a list of results without splitting the strings (into "movie_api_result_unprocessed.csv") | |
# AND it writes a separate file each for writers and directors, with very good handling of the unusual text within these fields (e.g. commas, parentheses) | |
# A further improvement to consider adding later is a handling for parentheses in the INPUT movie titles, it looks like these might indicate foreign films, and should b |
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
# April 3rd 2017 | |
# This version of testing the Open Movie Database API is working well but falls down with large numbers (possibly because the API deliberately throttles our requests after a certain threshold) | |
# THe other vulnerability is in internaational characters - it is definitely writing them out in a strange and unusable fashion | |
# BUT this does work: it outputs a list of results without splitting the strings (into "movie_api_result_unprocessed.csv") | |
# AND it writes a separate file each for writers and directors, with very good handling of the unusual text within these fields (e.g. commas, parentheses) | |
require "csv" | |
require "json" | |
require "net/http" |
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
require "csv" | |
require "json" | |
require "net/http" | |
puts "START MOVIE TEST ******" | |
input_movie_titles = CSV.read("movies.csv").map { |row| | |
row[1] | |
}.uniq |
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
require "csv" | |
require "json" | |
movie_titles = CSV.read("movies.csv").map { |row| | |
row[1] | |
}.uniq | |
movie_results = movie_titles.first(10).map { |movie_title| | |
print(".") | |
[movie_title, JSON.parse(`curl "http://www.omdbapi.com/?t=#{movie_title.gsub(/\s/,"+")}"`)] | |
} |
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
curl "http://www.omdbapi.com/?t=The+Matrix" |
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
irb | |
# http://www.omdbapi.com/ | |
test2 = %q{{"Title":"Avengers: Age of Ultron","Year":"2015","Rated":"PG-13","Released":"01 May 2015","Runtime":"141 min","Genre":"Action, Adventure, Sci-Fi","Director":"Joss Whedon","Writer":"Joss Whedon, Stan Lee (based on the Marvel comics by), Jack Kirby (based on the Marvel comics by), Joe Simon (character created by: Captain America), Jack Kirby (character created by: Captain America), Jim Starlin (character created by: Thanos)","Actors":"Robert Downey Jr., Chris Hemsworth, Mark Ruffalo, Chris Evans","Plot":"When Tony Stark and Bruce Banner try to jump-start a dormant peacekeeping program called Ultron, things go horribly wrong and it's up to Earth's Mightiest Heroes to stop the villainous Ultron from enacting his terrible plans.","Language":"English","Country":"USA","Awards":"5 wins & 42 nominations.","Poster":"https://images-na.ssl-images-amazon.com/images/M/MV5BMTM4OGJmNWMtOTM4Ni00NTE3LTg3MDItZmQxYjc4N2JhNmUxXkEyXkFqcGdeQXVyNTgzMDMzMTg@._V1_SX300.jpg","Ratings":[{"Source" |