crunchyroll 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crunchyroll.rb +22 -22
- data/lib/crunchyroll/crunchyroll.rb +89 -88
- data/lib/crunchyroll/utils.rb +54 -54
- data/lib/crunchyroll/version.rb +19 -19
- metadata +5 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85ab318fb2e676e603eb3247309d454a3b912de2
|
4
|
+
data.tar.gz: 58f0acac77485d87c945db353bc7ead687ea4301
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae0641019426f32d9ff0694a1c0f1db0f0aec833fb330a6a50510ab14e9696aeffd05434302d8c23064f91048373791e82be4b927072ed7ea8291467791f8c6f
|
7
|
+
data.tar.gz: 927236237254e4636c832a7015cf5c5574924503ffa25e27145fa635f78ce7ff4dc8f2c1e0dba8119d378c9bbc0d851aafa78e4905ef478349d7d0efead02f17
|
data/lib/crunchyroll.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
##
|
2
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
-
# Version 2, December 2004
|
4
|
-
#
|
5
|
-
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
-
# copies of this license document, and changing it is allowed as long
|
7
|
-
# as the name is changed.
|
8
|
-
#
|
9
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
-
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
-
#
|
12
|
-
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
-
##
|
14
|
-
|
15
|
-
require 'open-uri'
|
16
|
-
require 'nokogiri'
|
17
|
-
require 'active_support/time'
|
18
|
-
require 'time_difference'
|
19
|
-
require 'chronic'
|
20
|
-
|
21
|
-
require 'crunchyroll/utils'
|
22
|
-
require 'crunchyroll/crunchyroll'
|
1
|
+
##
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
+
# copies of this license document, and changing it is allowed as long
|
7
|
+
# as the name is changed.
|
8
|
+
#
|
9
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
+
#
|
12
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
+
##
|
14
|
+
|
15
|
+
require 'open-uri'
|
16
|
+
require 'nokogiri'
|
17
|
+
require 'active_support/time'
|
18
|
+
require 'time_difference'
|
19
|
+
require 'chronic'
|
20
|
+
|
21
|
+
require 'crunchyroll/utils'
|
22
|
+
require 'crunchyroll/crunchyroll'
|
23
23
|
require 'crunchyroll/version'
|
@@ -1,88 +1,89 @@
|
|
1
|
-
##
|
2
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
-
# Version 2, December 2004
|
4
|
-
#
|
5
|
-
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
-
# copies of this license document, and changing it is allowed as long
|
7
|
-
# as the name is changed.
|
8
|
-
#
|
9
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
-
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
-
#
|
12
|
-
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
-
##
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Time.zone = 'MST'
|
18
|
-
Chronic.time_class = Time.zone
|
19
|
-
|
20
|
-
module Crunchyroll
|
21
|
-
class << self
|
22
|
-
|
23
|
-
def find(series, time_zone = 'Rome')
|
24
|
-
url = ''
|
25
|
-
title = ''
|
26
|
-
cr = 'http://www.iamalittlekitty.info/index.php?q=aHR0cDovL3d3dy5jcnVuY2h5cm9sbC5jb20vbGluZXVw&hl=3ed'
|
27
|
-
Nokogiri::HTML(open(cr)).xpath('//a[@class="portrait-element block-link titlefix element-lineup-anime"]').each { |r|
|
28
|
-
if r['title'].downcase.include? series.downcase
|
29
|
-
title = r['title']
|
30
|
-
url = r['href' ]
|
31
|
-
break
|
32
|
-
end
|
33
|
-
}
|
34
|
-
return false if title.empty? || url.empty?
|
35
|
-
|
36
|
-
air = Nokogiri::HTML(open(url)).xpath('//ul[@id="sidebar_elements"]/li').select { |e| e.at_xpath('.//p[@class="strong"]') }[0]
|
37
|
-
return false unless air
|
38
|
-
|
39
|
-
air = air.text
|
40
|
-
day_literal = air.split('Simulcast on ')[1].split(' ')[0][0..-2]
|
41
|
-
date = Time.parse(air.format_cr_date)
|
42
|
-
date = Chronic.parse("this #{day_literal} at #{date.hour}:#{date.min}").in_time_zone time_zone
|
43
|
-
|
44
|
-
{
|
45
|
-
:title => title,
|
46
|
-
:where => 'Crunchyroll',
|
47
|
-
:day => day_literal,
|
48
|
-
:hour => date.hour <= 9 ? "0#{date.hour}" : date.hour,
|
49
|
-
:min => date.min <= 9 ? "0#{date.min}" : date.min,
|
50
|
-
:left => Time.now.left(date)
|
51
|
-
}
|
52
|
-
end
|
53
|
-
alias_method :get, :find
|
54
|
-
|
55
|
-
def today(time_zone = 'Rome')
|
56
|
-
url = 'http://horriblesubs.info/release-schedule/'
|
57
|
-
tomorrow = Date.tomorrow
|
58
|
-
today = Time.now
|
59
|
-
|
60
|
-
[].tap { |releases|
|
61
|
-
Nokogiri::HTML(open(url)).xpath('//div[@class="today-releases"]/div[@class="series-name"]').each { |r|
|
62
|
-
title = r.at_xpath('.//child::text()').to_s.squeeze(' ')
|
63
|
-
time = r.at_xpath('.//span').text
|
64
|
-
date = Chronic.parse("today at #{time}").in_time_zone time_zone
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
1
|
+
##
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
+
# copies of this license document, and changing it is allowed as long
|
7
|
+
# as the name is changed.
|
8
|
+
#
|
9
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
+
#
|
12
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
+
##
|
14
|
+
|
15
|
+
using Utils
|
16
|
+
|
17
|
+
Time.zone = 'MST'
|
18
|
+
Chronic.time_class = Time.zone
|
19
|
+
|
20
|
+
module Crunchyroll
|
21
|
+
class << self
|
22
|
+
|
23
|
+
def find(series, time_zone = 'Rome')
|
24
|
+
url = ''
|
25
|
+
title = ''
|
26
|
+
cr = 'http://www.iamalittlekitty.info/index.php?q=aHR0cDovL3d3dy5jcnVuY2h5cm9sbC5jb20vbGluZXVw&hl=3ed'
|
27
|
+
Nokogiri::HTML(open(cr)).xpath('//a[@class="portrait-element block-link titlefix element-lineup-anime"]').each { |r|
|
28
|
+
if r['title'].downcase.include? series.downcase
|
29
|
+
title = r['title']
|
30
|
+
url = r['href' ]
|
31
|
+
break
|
32
|
+
end
|
33
|
+
}
|
34
|
+
return false if title.empty? || url.empty?
|
35
|
+
|
36
|
+
air = Nokogiri::HTML(open(url)).xpath('//ul[@id="sidebar_elements"]/li').select { |e| e.at_xpath('.//p[@class="strong"]') }[0]
|
37
|
+
return false unless air
|
38
|
+
|
39
|
+
air = air.text
|
40
|
+
day_literal = air.split('Simulcast on ')[1].split(' ')[0][0..-2]
|
41
|
+
date = Time.parse(air.format_cr_date)
|
42
|
+
date = Chronic.parse("this #{day_literal} at #{date.hour}:#{date.min}").in_time_zone time_zone
|
43
|
+
|
44
|
+
{
|
45
|
+
:title => title,
|
46
|
+
:where => 'Crunchyroll',
|
47
|
+
:day => day_literal,
|
48
|
+
:hour => date.hour <= 9 ? "0#{date.hour}" : date.hour,
|
49
|
+
:min => date.min <= 9 ? "0#{date.min}" : date.min,
|
50
|
+
:left => Time.now.left(date)
|
51
|
+
}
|
52
|
+
end
|
53
|
+
alias_method :get, :find
|
54
|
+
|
55
|
+
def today(time_zone = 'Rome')
|
56
|
+
url = 'http://horriblesubs.info/release-schedule/'
|
57
|
+
tomorrow = Date.tomorrow
|
58
|
+
today = Time.now
|
59
|
+
|
60
|
+
[].tap { |releases|
|
61
|
+
Nokogiri::HTML(open(url)).xpath('//div[@class="today-releases"]/div[@class="series-name"]').each { |r|
|
62
|
+
title = r.at_xpath('.//child::text()').to_s.squeeze(' ')
|
63
|
+
time = r.at_xpath('.//span').text
|
64
|
+
date = Chronic.parse("today at #{time}").in_time_zone time_zone
|
65
|
+
date -= 3600 if date.dst?
|
66
|
+
|
67
|
+
time_diff = TimeDifference.between(today, date).in_general
|
68
|
+
airs = if date.day == tomorrow.day && time_diff[:days] == 0
|
69
|
+
:tomorrow
|
70
|
+
else
|
71
|
+
time_diff[:days] == 0 ? :today : :aired
|
72
|
+
end
|
73
|
+
|
74
|
+
releases << {
|
75
|
+
:title => title,
|
76
|
+
:where => 'Crunchyroll',
|
77
|
+
:date => date,
|
78
|
+
:airs => airs,
|
79
|
+
:day => date.strftime("%A"),
|
80
|
+
:hour => date.hour,
|
81
|
+
:min => date.min,
|
82
|
+
:left => today.left(date)
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}.sort_by { |h| h[:date] }
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
data/lib/crunchyroll/utils.rb
CHANGED
@@ -1,55 +1,55 @@
|
|
1
|
-
##
|
2
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
-
# Version 2, December 2004
|
4
|
-
#
|
5
|
-
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
-
# copies of this license document, and changing it is allowed as long
|
7
|
-
# as the name is changed.
|
8
|
-
#
|
9
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
-
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
-
#
|
12
|
-
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
-
##
|
14
|
-
|
15
|
-
module Utils
|
16
|
-
refine Time do
|
17
|
-
def left(end_time)
|
18
|
-
diff = TimeDifference.between(self, end_time).in_general
|
19
|
-
|
20
|
-
secs = diff[:seconds].to_i
|
21
|
-
mins = diff[:minutes].to_i
|
22
|
-
hours = diff[:hours ].to_i
|
23
|
-
days = diff[:days ].to_i
|
24
|
-
|
25
|
-
if days > 0
|
26
|
-
"#{days} days, #{hours} hours, #{mins} minutes and #{secs} seconds"
|
27
|
-
elsif hours > 0
|
28
|
-
"#{hours} hours, #{mins} minutes and #{secs} seconds"
|
29
|
-
elsif mins > 0
|
30
|
-
"#{mins} minutes and #{secs} seconds"
|
31
|
-
elsif secs >= 0
|
32
|
-
"#{secs} seconds"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
refine String do
|
38
|
-
def to_24h
|
39
|
-
DateTime.parse(self).strftime("%H:%M")
|
40
|
-
end
|
41
|
-
|
42
|
-
def format_cr_date
|
43
|
-
s = ''
|
44
|
-
self.split('Simulcast on ')[1][0..-5].split.each { |d| s += d.end_with?(?s) ? d[0..-2] : d; s += ' ' }
|
45
|
-
|
46
|
-
am_pm = s.strip[-2..-1]
|
47
|
-
s = s.strip[0..-3]
|
48
|
-
|
49
|
-
day_time = s.split
|
50
|
-
day = day_time.shift
|
51
|
-
time = day_time.shift.to_24h
|
52
|
-
return "#{day} #{time}"
|
53
|
-
end
|
54
|
-
end
|
1
|
+
##
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
+
# copies of this license document, and changing it is allowed as long
|
7
|
+
# as the name is changed.
|
8
|
+
#
|
9
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
+
#
|
12
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
+
##
|
14
|
+
|
15
|
+
module Utils
|
16
|
+
refine Time do
|
17
|
+
def left(end_time)
|
18
|
+
diff = TimeDifference.between(self, end_time).in_general
|
19
|
+
|
20
|
+
secs = diff[:seconds].to_i
|
21
|
+
mins = diff[:minutes].to_i
|
22
|
+
hours = diff[:hours ].to_i
|
23
|
+
days = diff[:days ].to_i
|
24
|
+
|
25
|
+
if days > 0
|
26
|
+
"#{days} days, #{hours} hours, #{mins} minutes and #{secs} seconds"
|
27
|
+
elsif hours > 0
|
28
|
+
"#{hours} hours, #{mins} minutes and #{secs} seconds"
|
29
|
+
elsif mins > 0
|
30
|
+
"#{mins} minutes and #{secs} seconds"
|
31
|
+
elsif secs >= 0
|
32
|
+
"#{secs} seconds"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
refine String do
|
38
|
+
def to_24h
|
39
|
+
DateTime.parse(self).strftime("%H:%M")
|
40
|
+
end
|
41
|
+
|
42
|
+
def format_cr_date
|
43
|
+
s = ''
|
44
|
+
self.split('Simulcast on ')[1][0..-5].split.each { |d| s += d.end_with?(?s) ? d[0..-2] : d; s += ' ' }
|
45
|
+
|
46
|
+
am_pm = s.strip[-2..-1]
|
47
|
+
s = s.strip[0..-3]
|
48
|
+
|
49
|
+
day_time = s.split
|
50
|
+
day = day_time.shift
|
51
|
+
time = day_time.shift.to_24h
|
52
|
+
return "#{day} #{time}"
|
53
|
+
end
|
54
|
+
end
|
55
55
|
end
|
data/lib/crunchyroll/version.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
##
|
2
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
-
# Version 2, December 2004
|
4
|
-
#
|
5
|
-
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
-
# copies of this license document, and changing it is allowed as long
|
7
|
-
# as the name is changed.
|
8
|
-
#
|
9
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
-
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
-
#
|
12
|
-
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
-
##
|
14
|
-
|
15
|
-
module Crunchyroll
|
16
|
-
def self.version
|
17
|
-
'0.9.
|
18
|
-
end
|
19
|
-
end
|
1
|
+
##
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
6
|
+
# copies of this license document, and changing it is allowed as long
|
7
|
+
# as the name is changed.
|
8
|
+
#
|
9
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
+
#
|
12
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
+
##
|
14
|
+
|
15
|
+
module Crunchyroll
|
16
|
+
def self.version
|
17
|
+
'0.9.6'
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,81 +1,25 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crunchyroll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: nokogiri
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: time_difference
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: chronic
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: activesupport
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
69
13
|
description: Find and get infos about series airing on Crunchyroll.
|
70
14
|
email: webmaster@giovannicapuano.net
|
71
15
|
executables: []
|
72
16
|
extensions: []
|
73
17
|
extra_rdoc_files: []
|
74
18
|
files:
|
19
|
+
- lib/crunchyroll.rb
|
75
20
|
- lib/crunchyroll/crunchyroll.rb
|
76
21
|
- lib/crunchyroll/utils.rb
|
77
22
|
- lib/crunchyroll/version.rb
|
78
|
-
- lib/crunchyroll.rb
|
79
23
|
homepage: http://www.giovannicapuano.net
|
80
24
|
licenses:
|
81
25
|
- WTFPL
|
@@ -96,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
40
|
version: '0'
|
97
41
|
requirements: []
|
98
42
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
43
|
+
rubygems_version: 2.2.2
|
100
44
|
signing_key:
|
101
45
|
specification_version: 4
|
102
46
|
summary: Find a series airing on Crunchyroll.
|