crunchyroll 0.9.7.2 → 0.9.7.3

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: ace63fc12051acb24b34657618d904a16998eab5
4
- data.tar.gz: 51112dcc884d4521460b71542b044953c49831e8
3
+ metadata.gz: c940bc70582c33ace13b8899bdb746bb98ccd9c0
4
+ data.tar.gz: c3c50d83ad7116ee330aa6906a34831e74207b69
5
5
  SHA512:
6
- metadata.gz: 9d6258bafc4aa1746b87be0f9a62f8c7b8a78b121132519e62fbe9a7001a534e16a3c3b41fcc366b53bb44da8bac5bcb8d99906dbc87ccefafadf0c9e4180dae
7
- data.tar.gz: 203860d3db27a0e44e447e526311012dec648e9f2503478fd7a15e8c78274332644f03f284b51ef7a560c2bb498a769ec0069767c2dc3f8097b1e4b0a98e273e
6
+ metadata.gz: ac20016f861fd6427cddf668f25e0226d9ce49a1a5f13fb8c85d85f4403a7bebf37f68cc0f39e9ca385db255916dfc7d0261ffdf4bfea0f18a639f63375f3808
7
+ data.tar.gz: 0369102da6a63c06c45743378f2589bbf1983e6a8ac1baba342f07458fb22e20111f5a3eb2758a556501963cf44cd3c31e03a7a29ac08d7180cc448d60e7383f
@@ -1,18 +1,19 @@
1
1
  ##
2
2
  # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
3
  # Version 2, December 2004
4
- #
4
+ #
5
5
  # Everyone is permitted to copy and distribute verbatim or modified
6
6
  # copies of this license document, and changing it is allowed as long
7
7
  # as the name is changed.
8
- #
8
+ #
9
9
  # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
10
  # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
- #
11
+ #
12
12
  # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
13
  ##
14
14
 
15
15
  require 'open-uri'
16
+ require 'net/http'
16
17
  require 'nokogiri'
17
18
  require 'active_support/time'
18
19
  require 'time_difference'
@@ -20,4 +21,4 @@ require 'chronic'
20
21
 
21
22
  require 'crunchyroll/utils'
22
23
  require 'crunchyroll/crunchyroll'
23
- require 'crunchyroll/version'
24
+ require 'crunchyroll/version'
@@ -20,12 +20,19 @@ Chronic.time_class = Time.zone
20
20
  module Crunchyroll
21
21
  class << self
22
22
 
23
- def find(series, time_zone = 'Rome', proxy = 'http://108.165.33.12:3128')
24
- ENV['http_proxy'] ||= proxy
23
+ def find(series, time_zone = 'Rome', proxy = nil, use_proxy = true)
24
+ cr = URI('http://www.crunchyroll.com/lineup')
25
+
26
+ response = if use_proxy
27
+ proxy ||= { host: '23.25.88.181', port: '8080' }
28
+ Net::HTTP::Proxy(proxy[:host], proxy[:port]).start(cr.host, cr.port) { |r| r.request(Net::HTTP::Get.new(cr.path)) }.body
29
+ else
30
+ open(cr.to_s).read
31
+ end
25
32
 
26
33
  title, url = [''] * 2
27
- cr = 'http://www.crunchyroll.com/lineup'
28
- Nokogiri::HTML(open(cr)).xpath('//a[@class="portrait-element block-link titlefix element-lineup-anime"]').each do |r|
34
+
35
+ Nokogiri::HTML(response).xpath('//a[@class="portrait-element block-link titlefix element-lineup-anime"]').each do |r|
29
36
  if r['title'].downcase.include? series.downcase
30
37
  title = r['title']
31
38
  url = r['href' ]
@@ -14,6 +14,6 @@
14
14
 
15
15
  module Crunchyroll
16
16
  def self.version
17
- '0.9.7.2'
17
+ '0.9.7.3'
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchyroll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7.2
4
+ version: 0.9.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano