peerflixrb 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/exe/peerflixrb +3 -2
- data/lib/peerflixrb/version.rb +1 -1
- data/peerflixrb.gemspec +1 -0
- metadata +16 -5
- data/lib/peerflixrb/kat.rb +0 -50
- data/lib/peerflixrb/link.rb +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16170568747511393f4fbf2bb7e3b37b3fbbab41
|
4
|
+
data.tar.gz: 11f884e301797a200f4b7f7dae34c9e1cb85d61f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9093448f7c60160aa47a0ffb5146a48590a00298187038b48efaf760ef00f185b3d80334878f1a07bdc73edf23e90960065c29bef7701e862b58e5f7378c6187
|
7
|
+
data.tar.gz: 276dcde0d6f4d9521bf36d0a10539b8526e5b4f416fb4604b5448723e358a2c66c1b48256f6610836e7ec16a5dd052ababade1a7473fb75fba54e884fa2a60c3
|
data/README.md
CHANGED
@@ -48,6 +48,8 @@ You can autoplay in VLC or mpv with the corresponding option (Default: VLC).
|
|
48
48
|
|
49
49
|
$ peerflixrb --mpv The Big Bang Theory s09e16 HDTV
|
50
50
|
|
51
|
+
It works with DLNA too with the ```-u``` option (subtitles too!).
|
52
|
+
|
51
53
|
Or you can just let it download without autoplaying with ```-n``` or ```--no-player```.
|
52
54
|
|
53
55
|
|
data/exe/peerflixrb
CHANGED
@@ -4,6 +4,7 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
|
|
4
4
|
require 'optparse'
|
5
5
|
require 'peerflixrb'
|
6
6
|
require 'peerflixrb/commands'
|
7
|
+
require 'kat_search'
|
7
8
|
|
8
9
|
options = {
|
9
10
|
language: 'en',
|
@@ -82,10 +83,10 @@ begin
|
|
82
83
|
|
83
84
|
# KAT Search
|
84
85
|
cli.say "Searching KAT for #{options[:search].blue}".yellow
|
85
|
-
kat_search =
|
86
|
+
kat_search = KatSearch::Search.new(options[:search])
|
86
87
|
|
87
88
|
# Did it find results?
|
88
|
-
|
89
|
+
unless kat_search.results_found?
|
89
90
|
cli.say "No results found for #{options[:search].blue}".red
|
90
91
|
exit
|
91
92
|
end
|
data/lib/peerflixrb/version.rb
CHANGED
data/peerflixrb.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'addic7ed_downloader', '~> 1.0'
|
23
|
+
spec.add_runtime_dependency 'kat_search', '~> 1.0'
|
23
24
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
24
25
|
spec.add_runtime_dependency 'highline', '~> 1.7'
|
25
26
|
spec.add_runtime_dependency 'httparty', '~> 0.13'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peerflixrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Marchante
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addic7ed_downloader
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: kat_search
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: nokogiri
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,8 +230,6 @@ files:
|
|
216
230
|
- lib/peerflixrb.rb
|
217
231
|
- lib/peerflixrb/commands.rb
|
218
232
|
- lib/peerflixrb/imdb.rb
|
219
|
-
- lib/peerflixrb/kat.rb
|
220
|
-
- lib/peerflixrb/link.rb
|
221
233
|
- lib/peerflixrb/version.rb
|
222
234
|
- lib/peerflixrb/yify.rb
|
223
235
|
- peerflixrb.gemspec
|
@@ -247,4 +259,3 @@ specification_version: 4
|
|
247
259
|
summary: Wrapper for peerflix with automatic search through KickAss Torrents, Yifysubtitles
|
248
260
|
and Addic7ed.
|
249
261
|
test_files: []
|
250
|
-
has_rdoc:
|
data/lib/peerflixrb/kat.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
require 'nokogiri'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
module Peerflixrb
|
6
|
-
##
|
7
|
-
# Extract a list of results from your search
|
8
|
-
# KAT.new("Suits s05e16 1080p")
|
9
|
-
class KAT
|
10
|
-
NUMBER_OF_LINKS = 5
|
11
|
-
|
12
|
-
attr_accessor :url
|
13
|
-
|
14
|
-
def initialize(search)
|
15
|
-
@url = "https://kat.cr/usearch/#{ERB::Util.url_encode(search)}/"
|
16
|
-
end
|
17
|
-
|
18
|
-
def page
|
19
|
-
@page ||= Nokogiri::HTML(open(@url))
|
20
|
-
end
|
21
|
-
|
22
|
-
def results_found
|
23
|
-
@results_found ||= page.at('p:contains("did not match any documents")').nil?
|
24
|
-
rescue OpenURI::HTTPError
|
25
|
-
@results_found = false
|
26
|
-
end
|
27
|
-
|
28
|
-
def links
|
29
|
-
@links ||= generate_links
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def generate_links
|
35
|
-
links = []
|
36
|
-
crawled_links = page.css('.iaconbox > div')
|
37
|
-
seeders = page.css('td.green')
|
38
|
-
leechers = page.css('td.red')
|
39
|
-
|
40
|
-
crawled_links[0..NUMBER_OF_LINKS - 1].each_with_index do |link, i|
|
41
|
-
params = YAML.load(link['data-sc-params'])
|
42
|
-
params['seeders'] = seeders[i].text
|
43
|
-
params['leechers'] = leechers[i].text
|
44
|
-
links << Link.new(params)
|
45
|
-
end
|
46
|
-
|
47
|
-
return links
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/lib/peerflixrb/link.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'cgi'
|
2
|
-
require 'open-uri'
|
3
|
-
|
4
|
-
module Peerflixrb
|
5
|
-
##
|
6
|
-
# Object that contains the info for a torrent file
|
7
|
-
class Link
|
8
|
-
@@max_length_name ||= 0
|
9
|
-
|
10
|
-
attr_reader :seeders, :leechers
|
11
|
-
|
12
|
-
def initialize(params)
|
13
|
-
@params = params
|
14
|
-
@seeders = params['seeders']
|
15
|
-
@leechers = params['leechers']
|
16
|
-
|
17
|
-
# Get the longest filename for pretty print
|
18
|
-
set_max_length_name(filename.length)
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_s
|
22
|
-
"#{filename.ljust(@@max_length_name + 2)} (#{@seeders.green}/#{@leechers.red})"
|
23
|
-
end
|
24
|
-
|
25
|
-
def filename
|
26
|
-
@filename ||= "#{CGI.unescape(@params['name'])}.#{@params['extension']}"
|
27
|
-
end
|
28
|
-
|
29
|
-
def magnet
|
30
|
-
@magnet ||= @params['magnet']
|
31
|
-
end
|
32
|
-
|
33
|
-
def info_hash
|
34
|
-
@info_hash ||= extract_hash
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def extract_hash
|
40
|
-
# Extract magnet properties to a Hash and then parse the sha1 info hash
|
41
|
-
magnet_params = CGI.parse(URI.parse(magnet).query)
|
42
|
-
magnet_params['xt'].first.match(/[0-9A-Fa-f]{20,}/).to_s.downcase
|
43
|
-
end
|
44
|
-
|
45
|
-
def set_max_length_name(length)
|
46
|
-
@@max_length_name = length if @@max_length_name < length
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|