sportsflix 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1098181cb30e1113e86873aef58c5a08508b17ed
4
- data.tar.gz: 966fbf8efa3512ba61f4d3efc2eb84434ece01e1
3
+ metadata.gz: 5ae74f83e94368964eefc12a4f973a7e1aed4a0e
4
+ data.tar.gz: 1623ac63bfb583d3eb2aaa8545907851923e83c8
5
5
  SHA512:
6
- metadata.gz: 1dea2ac73946a63eee21ba71d34ab49cd527094c142a74085df67f5f54d22ff57eb2e7d5f6a0b60ffb12b6abc60eaa2337d036f72c642f25f3812da461d34a40
7
- data.tar.gz: 380551127bd31184e92048bb6b504540eefc0af55a6552556fc7f89cafc31675bbc03fe932aa7c02d867c5908ede5467f09f44659c25180dfb13973f36056348
6
+ metadata.gz: 5067531f02ed1a13c87af36b834291fc3528ed668dcda198099b662c776404539b494cc60a16a4f32c2322facc1e18b72488db2cac7ee34943d2647790f6118e
7
+ data.tar.gz: dd693a82da31321bd2e0261362e632520ba798b5552be04f84f729eabdf5d50473b075d2aa8a14b4da1a2e3cc123655fe234c95828edb03bad876977d5b83a82
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportsflix (1.2.7)
4
+ sportsflix (1.2.8)
5
5
  execjs-fastnode (~> 0.2.0)
6
6
  oga (~> 2.8)
7
7
  thor (~> 0.19.4)
@@ -74,4 +74,4 @@ DEPENDENCIES
74
74
  sportsflix!
75
75
 
76
76
  BUNDLED WITH
77
- 1.15.4
77
+ 1.16.1
@@ -5,7 +5,7 @@ module Sportsflix
5
5
  module Providers
6
6
  module Arenavision
7
7
  class Client
8
- BASE_URLS = ['http://arenavision.in', 'http://arenavision.ru']
8
+ BASE_URLS = ['http://arenavision.in', 'http://arenavision.ru', 'http://arenavision.us']
9
9
  BASE_URL = BASE_URLS.sample
10
10
 
11
11
  def initialize(options)
@@ -17,8 +17,13 @@ module Sportsflix
17
17
 
18
18
  def list_streams
19
19
  home = get_page_contents("#{BASE_URL}/")
20
- schedule_path = home.css('a').select {|item| item.text.include?('EVENTS GUIDE')}.first.get('href')
21
- schedule = get_page_contents("#{BASE_URL}#{schedule_path}")
20
+ schedule_path = home.css('a').select { |item| item.text.include?('EVENTS GUIDE') }.first.get('href')
21
+ schedule_url = if schedule_path.start_with?("http")
22
+ schedule_path
23
+ else
24
+ "#{BASE_URL}#{schedule_path}"
25
+ end
26
+ schedule = get_page_contents(schedule_url)
22
27
  streams = schedule.css('table tr')
23
28
  # Remove first element
24
29
  streams = streams.drop(1)
@@ -35,25 +40,28 @@ module Sportsflix
35
40
 
36
41
  streams.map do |item|
37
42
  {
38
- :date => clean_str(item.css('td:nth-child(1)').text),
39
- :hour => clean_str(item.css('td:nth-child(2)').text),
40
- :sport => clean_str(item.css('td:nth-child(3)').text),
41
- :competition => clean_str(item.css('td:nth-child(4)').text),
42
- :game => clean_str(item.css('td:nth-child(5)').text),
43
- :stream_nr => parse_stream_ids(clean_str(item.css('td:nth-child(6)').text)),
44
- :proxy => :acestream
43
+ :date => clean_str(item.css('td:nth-child(1)').text),
44
+ :hour => clean_str(item.css('td:nth-child(2)').text),
45
+ :sport => clean_str(item.css('td:nth-child(3)').text),
46
+ :competition => clean_str(item.css('td:nth-child(4)').text),
47
+ :game => clean_str(item.css('td:nth-child(5)').text),
48
+ :stream_nr => parse_stream_ids(clean_str(item.css('td:nth-child(6)').text)),
49
+ :proxy => :acestream
45
50
  }
46
51
  end
47
52
  end
48
53
 
49
54
  def get_stream_uri(stream_nr)
50
- stream_raw = get_page_contents("#{BASE_URL}/#{stream_nr.to_s.rjust(2, '0')}")
51
- stream_raw.css('p[class="auto-style1"] a').first.get('href')
55
+ home = get_page_contents("#{BASE_URL}/")
56
+ stream_link = home.css('a').select { |item| item.text.include?("ArenaVision #{stream_nr}") }.first.get('href')
57
+ stream_raw = get_page_contents(stream_link)
58
+ stream_raw.css('a').select { |item| !item.get('href').nil? && item.get('href').include?('acestream://') }.first.get('href')
52
59
  end
53
60
 
54
61
  private
62
+
55
63
  def get_page_contents(raw_url)
56
- html_str = @http.get(raw_url, {}, {Cookie: 'beget=begetok;'}).body
64
+ html_str = @http.get(raw_url, {}, { Cookie: 'beget=begetok;' }).body
57
65
  Oga.parse_xml(html_str)
58
66
  end
59
67
 
@@ -61,17 +69,17 @@ module Sportsflix
61
69
  matches = raw_stream.scan(/(([0-9]+)(?:-([0-9]+))? \[(.+?)\])/)
62
70
  matches.map do |match|
63
71
  {
64
- :start => match[1].to_i,
65
- :end => (match[2] || match[1]).to_i,
66
- :language => match[3]
72
+ :start => match[1].to_i,
73
+ :end => (match[2] || match[1]).to_i,
74
+ :language => match[3]
67
75
  }
68
76
  end
69
77
  end
70
78
 
71
79
  def clean_str(str)
72
80
  str.force_encoding('UTF-8')
73
- .gsub("\n\t\t", ' ')
74
- .strip
81
+ .gsub("\n\t\t", ' ')
82
+ .strip
75
83
  end
76
84
 
77
85
  end
@@ -1,3 +1,3 @@
1
1
  module Sportsflix
2
- VERSION = '1.2.7'
2
+ VERSION = '1.2.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportsflix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Fernandes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-19 00:00:00.000000000 Z
11
+ date: 2018-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler