Last active
October 25, 2015 03:36
-
-
Save farfanoide/3fe37cb5fede2e2d3eb9 to your computer and use it in GitHub Desktop.
get latets yts.re movies and optionally download one or more
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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# ------------------------------------------------------------------------------ | |
# Description | |
# ----------- | |
# | |
# Script to show last 20 torrents uploaded to yts.to and | |
# optionally download some of them | |
# | |
# ------------------------------------------------------------------------------ | |
# Author | |
# ------- | |
# | |
# * Farfanoide (https://github.com/farfanoide) | |
# | |
# ------------------------------------------------------------------------------ | |
require 'net/http' | |
require 'json' | |
movies = JSON.parse(Net::HTTP.get(URI('http://yts.to/api/list.json?sort=date&order=desc')))['MovieList'] | |
movies.each_with_index { |movie, index| puts "[#{index}] #{movie['MovieTitle']} -- (#{movie['Quality']}) -- (#{movie['Size']}) -- (★ #{movie['MovieRating']})" } | |
puts '' | |
puts 'To select a movie to download, just enter the movie\'s index' | |
puts 'if you want to select various torrents, enter them separated with a whitespace' | |
puts '' | |
if indexes = gets | |
indexes = indexes.split(' ').map {|index| index.to_i} | |
indexes.each do |index| | |
movie = movies[index] | |
`curl --progress -S #{movie['TorrentUrl']} -o "$HOME/Downloads/#{movie['MovieTitle']}.torrent"` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vey cool. I've also created a gem for the V2 API. Though YTS is down right now :(