kat 2.0.10 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dbf7eb64fb4aea6fde8f14957ec36627aaee34d
4
- data.tar.gz: 674feb03cf0b17778254cbfdd678996113043119
3
+ metadata.gz: a1fa0fe28c43ead80b51d785b52389787b6817e7
4
+ data.tar.gz: d45433f08202c0864192109c6b1ebe06c5e5136c
5
5
  SHA512:
6
- metadata.gz: 6dad5630ae0721364b9333cef8129d08e874d374b814b8333ff7594e77e426f0394dca631bd38147624c4e449bd717daab67247aaa283ece211a534c3aa567fd
7
- data.tar.gz: f0392e612a194aff21f65705bc1e49fefe169ee18655abcf17236838a65a3c65519415d5403878cd8b700eb4816bea44f50cfd3dcafe69b50797f7fb66aa6e47
6
+ metadata.gz: 7912fe8de8beed4da9dccb8de9a0e37f67583869e0d4d78d178d18cccfa7113a836491ad178d8ca5d63b778edfef7dc3d3d976ca7f6c8fc0844cb26748c96639
7
+ data.tar.gz: 2fa1d5d1c5dbfad90d1bfff6e78726ade8a765becf942d873efc16721d971c7f17c2f700f7cbb1648984b6be9665607ed0b65caa018ba643090e7b01fe2f6860
@@ -258,8 +258,12 @@ module Kat
258
258
  def download(torrent)
259
259
  return [:failed, 'no download link available'].red unless torrent[:download]
260
260
 
261
- uri = URI(URI.encode torrent[:download])
261
+ # Lazy hack. Future Me won't be happy ¯\_(ツ)_/¯
262
+ unless (uri = URI(URI.encode torrent[:download])).scheme
263
+ uri = URI(URI.encode "https:#{torrent[:download]}")
264
+ end
262
265
  uri.query = nil
266
+
263
267
  file = "#{ @options[:output] || '.' }/" \
264
268
  "#{ torrent[:title].tr(' ', ?.).gsub(/[^a-z0-9()_.-]/i, '') }.torrent"
265
269
 
@@ -4,7 +4,7 @@ require 'nokogiri'
4
4
  require 'net/http'
5
5
 
6
6
  module Kat
7
- BASE_URL = 'http://kickass.to'
7
+ BASE_URL = 'https://kat.cr'
8
8
  RECENT_PATH = 'new'
9
9
  SEARCH_PATH = 'usearch'
10
10
  ADVANCED_URL = "#{ BASE_URL }/torrents/search/advanced/"
@@ -151,11 +151,11 @@ module Kat
151
151
 
152
152
  doc = Nokogiri::HTML(res.body)
153
153
 
154
- @results[page] = doc.xpath('//table[@class="data"]/tr[position()>1]/td[1]').map do |node|
154
+ @results[page] = doc.xpath('//table[@class="data"]//tr[position()>1]/td[1]').map do |node|
155
155
  { path: href_of(node, 'a.torType'),
156
156
  title: node.css('a.cellMainLink').text,
157
- magnet: href_of(node, 'a.imagnet'),
158
- download: href_of(node, 'a.idownload[title="Download torrent file"]'),
157
+ magnet: href_of(node, 'a[title="Torrent magnet link"]'),
158
+ download: href_of(node, 'a[title="Download torrent file"]'),
159
159
  size: (node = node.next_element).text,
160
160
  files: (node = node.next_element).text.to_i,
161
161
  age: (node = node.next_element).text,
@@ -225,9 +225,16 @@ module Kat
225
225
  k == label.intern
226
226
  end
227
227
 
228
- url = URI(ADVANCED_URL)
228
+ uri = URI(ADVANCED_URL)
229
+ req = Net::HTTP.get_response(uri)
230
+ if req.code == '301'
231
+ path = Net::HTTP::Get.new(req.header['location'])
232
+ req = Net::HTTP.start(uri.host) { |http| http.request path }
233
+ end
229
234
 
230
- req = Net::HTTP.start(url.host) { |http| http.get url }
235
+ # url = URI(ADVANCED_URL)
236
+ #
237
+ # req = Net::HTTP.start(url.host) { |http| http.get url }
231
238
  @@doc ||= Nokogiri::HTML(req.body)
232
239
 
233
240
  opts = @@doc.css('table.formtable td').detect do |e|
@@ -1,6 +1,6 @@
1
1
  module Kat
2
2
  NAME = 'Kickass Torrents Search'
3
- VERSION = '2.0.10'
3
+ VERSION = '2.0.11'
4
4
  MALEVOLENT_DICTATOR_FOR_LIFE = 'Fission Xuiptz'
5
5
  AUTHOR = MALEVOLENT_DICTATOR_FOR_LIFE
6
6
  VERSION_STR = "#{ NAME } #{ VERSION } (c) 2013 #{ MALEVOLENT_DICTATOR_FOR_LIFE }"
@@ -54,8 +54,8 @@ describe Kat::Search do
54
54
  end
55
55
 
56
56
  it 'returns a full result set' do
57
- blue_peter.search(1).size.must_equal 25
58
- blue_peter.titles.size.must_equal 50
57
+ (blue_peter.search(1).size > 10).must_equal true
58
+ (blue_peter.titles.size > 30).must_equal true
59
59
  end
60
60
 
61
61
  it 'returns a valid query string with options' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.10
4
+ version: 2.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fission Xuiptz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-05 00:00:00.000000000 Z
11
+ date: 2015-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.4.5
101
+ rubygems_version: 2.4.5.1
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Kickass Torrents Interface
@@ -107,3 +107,4 @@ test_files:
107
107
  - test/kat/test_colour.rb
108
108
  - test/kat/test_options.rb
109
109
  - test/kat/test_search.rb
110
+ has_rdoc: