torrents 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,14 +15,14 @@ module Container
15
15
  include Trackers
16
16
  # Downloads the URL, returns an empty string if an error occurred
17
17
  # Here we try to convert the downloaded content to UTF8,
18
- # if we're at least 80% sure that the content that was downloaded actally is was we think.
18
+ # if we're at least 60% sure that the content that was downloaded actally is was we think.
19
19
  # The timeout is set to 10 seconds, after that time, an empty string will be returned.
20
20
  # {url} (String) The URL to download
21
21
  def download(url)
22
22
  begin
23
23
  data = RestClient.get self.url_cleaner(url), {:timeout => 10, :cookies => @cookies}
24
24
  cd = CharDet.detect(data, silent: true)
25
- raise Exception.new("The confidence level for #{url} is to low: #{cd.confidence}") if not cd.encoding.to_s.match(/^UTF(-)?8$/) and cd.confidence < 0.8
25
+ raise Exception.new("The confidence level for #{url} is to low: #{cd.confidence}") if not cd.encoding.to_s.match(/^UTF(-)?8$/) and cd.confidence < 0.6
26
26
  return Iconv.conv(cd.encoding + "//IGNORE", "UTF-8", data) rescue data
27
27
  rescue Exception => error
28
28
  self.error("Something when wrong when trying to fetch #{url}", error)
@@ -42,7 +42,7 @@ describe Trackers::ThePirateBay do
42
42
  end
43
43
 
44
44
  it "should return the right details link when trying to fetch recent torrents" do
45
- rest_client("http://www.torrentleech.org/torrents/browse/index/page/1", "recent")
45
+ rest_client("http://thepiratebay.org/torrent/6173093/", "recent")
46
46
  Torrents.the_pirate_bay.results.each do |torrent|
47
47
  torrent.details.should match(/http:\/\/thepiratebay\.org\/torrent\/\d+/)
48
48
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "torrents"
6
- s.version = "1.0.10"
6
+ s.version = "1.0.11"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Linus Oleander"]
9
9
  s.email = ["linus@oleander.nu"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: torrents
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.10
5
+ version: 1.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Linus Oleander