Created
March 19, 2015 07:49
-
-
Save venj/08f2899f2dbdbfe27fc3 to your computer and use it in GitHub Desktop.
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 'zlib' | |
require 'open-uri' | |
class Torrent | |
attr_accessor :name, :magnet, :link | |
def initialize(line) | |
parts = line.split("|") | |
@name = parts[1].strip | |
@magnet = "magnet:?xt=urn:btih:#{parts[0].strip}" | |
@link = parts[2].strip | |
end | |
end | |
def parse_torrents(link) | |
open(link) do |f| | |
gz = Zlib::GzipReader.new(f) | |
torrents = [] | |
gz.each_line do |line| | |
next if line.strip.size == 0 | |
torrents << Torrent.new(line) | |
end | |
gz.close | |
torrents | |
end | |
end | |
def main | |
parse_torrents('https://kickass.to/hourlydump.txt.gz').each_with_index do |tr, index| | |
puts "#{index + 1}: " + tr.name + " -> " + tr.magnet if tr.name.include?("JAV") | |
end | |
end | |
main | |
# More to explorer: | |
# http://www.javlibrary.com/cn/vl_searchbyid.php?keyword=ATFB-257 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment