Skip to content

Instantly share code, notes, and snippets.

@jgthms
Created January 2, 2016 19:11
Show Gist options
  • Save jgthms/721c0c9072cb5fa92208 to your computer and use it in GitHub Desktop.
Save jgthms/721c0c9072cb5fa92208 to your computer and use it in GitHub Desktop.
IMDB "Who done it"
#!/usr/bin/env ruby
# https://www.reddit.com/r/movies/comments/1ebi5y/decent_who_done_it_films/
require 'json'
require 'open-uri'
@films=[]
def get_film(id)
json = JSON.parse(open('http://www.omdbapi.com/?i='+id).read())
puts json['Title']
return {
:score => json['imdbRating'],
:title => json['Title']
}
end
File.open('sources.txt', 'r') do |file_handle|
file_handle.each_line do |ids|
film = get_film(ids)
@films.push film
end
end
@films = @films.sort! {|x, y| x[:score] <=> y[:score] }
@films.reverse.each do |film|
puts "#{film[:score]} #{film[:title]}"
end
8.9 12 Angry Men
8.9 Fight Club
8.6 Se7en
8.6 The Usual Suspects
8.5 Sunset Blvd.
8.5 Rear Window
8.5 Memento
8.4 Witness for the Prosecution
8.4 Reservoir Dogs
8.4 High and Low
8.4 Oldboy
8.3 Chinatown
8.3 The Third Man
8.3 Endeavour
8.3 L.A. Confidential
8.2 The Big Lebowski
8.2 The Thin Man
8.2 The Thing
8.2 The Maltese Falcon
8.1 Memories of Murder
8.1 The Big Sleep
8.1 Diabolique
8.1 Stalag 17
8.1 Sleuth
8.1 Shutter Island
8.0 Charade
8.0 Rope
8.0 Mystic River
7.8 The Girl with the Dragon Tattoo
7.8 Peeping Tom
7.8 The White Ribbon
7.8 Lucky Number Slevin
7.8 The Game
7.8 The Name of the Rose
7.7 Primal Fear
7.7 Zodiac
7.7 Minority Report
7.7 Who Framed Roger Rabbit
7.7 Gone Baby Gone
7.6 Inside Man
7.6 Watchmen
7.6 Tell No One
7.6 Kiss Kiss Bang Bang
7.6 The Hunt for Red October
7.6 The House of Fear
7.6 And Then There Were None
7.5 Murder by Death
7.4 The Memory of a Killer
7.4 Brick
7.4 The Last of Sheila
7.3 The Ghost Breakers
7.3 Murder on the Orient Express
7.3 Clue
7.3 The Spanish Prisoner
7.3 Gosford Park
7.3 Hidden (Caché)
7.3 House of Games
7.3 The Negotiator
7.3 The Cat and the Canary
7.3 Identity
7.2 Star Trek VI: The Undiscovered Country
7.2 Scream
7.2 Unbreakable
7.2 Arlington Road
7.2 Winter's Bone
7.2 Death on the Nile
7.2 Strange Days
7.1 Tinker Tailor Soldier Spy
7.1 No Way Out
7.1 I, Robot
7.0 Suicide Kings
7.0 Jack Reacher
7.0 Evil Under the Sun
7.0 Terror by Night
7.0 Deathtrap
7.0 Fallen
6.9 Exam
6.9 Disturbia
6.8 Mystery Team
6.8 Pandorum
6.8 The Private Eyes
6.8 One Hour Photo
6.7 The Gift
6.7 Killer Joe
6.7 The Lovely Bones
6.7 Angels & Demons
6.6 Kiss the Girls
6.6 Vantage Point
6.6 The Bone Collector
6.6 Heist
6.5 The Mothman Prophecies
6.5 Unknown
6.5 A Perfect Getaway
6.5 8MM
6.5 Love Crime
6.5 The Cheap Detective
6.5 Shattered
6.5 Wild Things
6.5 Murder 101
6.5 Basic
6.5 The Pelican Brief
6.5 Session 9
6.4 Mindhunters
6.3 Kill List
6.3 Assassination of a High School President
6.2 Nightwatch
6.0 Righteous Kill
6.0 Bug
6.0 Kindergarten Cop
5.9 Dragnet
5.9 Cry_Wolf
5.9 The Double
5.8 The Paperboy
5.6 The Crucifer of Blood
5.5 The January Man
5.4 Red Riding Hood
4.9 Ordeal by Innocence
tt0050083
tt0134273
tt0971209
tt0037515
tt0808151
tt0137363
tt1018818
tt0264395
tt0393109
tt0470705
tt0387898
tt0056923
tt0071315
tt0088930
tt0384286
tt0077413
tt0083806
tt0046911
tt0486822
tt0092925
tt2039333
tt0083908
tt1258197
tt0119099
tt0137523
tt0452623
tt0280707
tt0252503
tt0057565
tt0093223
tt0343818
tt0309698
tt0454848
tt0790724
tt1788391
tt1726669
tt0099938
tt0373469
tt0119468
tt0119488
tt1459012
tt0425210
tt0209144
tt0353969
tt0297284
tt0181689
tt0102482
tt0074937
tt0071877
tt1237838
tt0327056
tt0119791
tt0093640
tt0364569
tt0265459
tt0087852
tt1188729
tt0054167
tt0117381
tt0047396
tt1486185
tt0105236
tt1034331
tt0040746
tt0117571
tt0114369
tt0261983
tt0102900
tt1130884
tt0069281
tt0046359
tt0102975
tt0114558
tt0120241
tt0043014
tt0362225
tt0039017
tt0118715
tt0038355
tt0145681
tt0031143
tt0077321
tt0101631
tt1646980
tt0119174
tt0032520
tt0219699
tt1568346
tt0037794
tt0099810
tt0097613
tt0070291
tt0380510
tt0033870
tt0374345
tt0265349
tt0091605
tt0120768
tt1496422
tt0107798
tt0081376
tt0120176
tt0025878
tt0084787
tt0041959
tt0114814
tt1149362
tt1340800
tt0217869
tt0450340
tt0443274
tt0409459
tt0096438
tt0120890
tt1399683
tt0051201
tt0443706
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment