funky 0.2.10 → 0.2.11

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: 63cac94890e722a693d619d7a181427084b99fb7
4
- data.tar.gz: 18cc9630f9fc4923e33ab9d09f2fa166ab03a305
3
+ metadata.gz: 3cb6573c5c4307f5428f7f8d49bc59d61725e580
4
+ data.tar.gz: 93da0ce27c0889babb4223e6556ea0fcb0339ebe
5
5
  SHA512:
6
- metadata.gz: 33d60d7d8f88082f4b5063c241f9dcc09bb28a17075c1757effc2cd93a9c1e47014bf7f55e846546d953b01e7ce50adbd7578295822e6aed33ae21062e7d532f
7
- data.tar.gz: 505d5ca3ff3a1aee9d9e173cdff1bb0d259213e94aeddb4b79a7b9cb3ee18086d6c708b23f7d1e2fc920ea8111bb3d990ea879b41417aa9d866b70897dd76406
6
+ metadata.gz: 1a8f7d9df7a690ab1023d9d9fdd716d163d56bd08df5d1fa58f0088cb26ca96c8963e690f178032ad67dee51e517c0d373c33a34b76043a30f22fe934d317842
7
+ data.tar.gz: 94e59a9cc3537e5521782033bb3f38b395911daa2fe397747cfa9bf3e787e775fe7d459fe018134233011e7719923c23c96337c03479815065e63a7ea1ceb758
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ For more information about changelogs, check
6
6
  [Keep a Changelog](http://keepachangelog.com) and
7
7
  [Vandamme](http://tech-angels.github.io/vandamme).
8
8
 
9
+ ## 0.2.11 - 2017/01/19
10
+
11
+ * [ENHANCEMENT] Follow redirects when Facebook responds with 302
12
+ * [ENHANCEMENT] Parse new format of view count in Facebook HTML
13
+
9
14
  ## 0.2.10 - 2016/12/20
10
15
 
11
16
  * [ENHANCEMENT] Add a facebook page ID as a part of the Funky::Video API
@@ -13,7 +18,7 @@ For more information about changelogs, check
13
18
 
14
19
  ## 0.2.9 - 2016/12/13
15
20
 
16
- * [BUGFIX] Allow a video ID to be parsed out of facebook video URLs with
21
+ * [BUGFIX] Allow a video ID to be parsed out of facebook video URLs with
17
22
  trailing slashes.
18
23
 
19
24
  ## 0.2.8 - 2016/12/12
@@ -16,9 +16,16 @@ module Funky
16
16
  def response_for(video_id)
17
17
  uri = uri_for video_id
18
18
  request = Net::HTTP::Get.new(uri.request_uri)
19
- Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
19
+ response = Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
20
20
  http.request request
21
21
  end
22
+ if response.is_a? Net::HTTPRedirection
23
+ request = Net::HTTP::Get.new URI.parse(response.header['location'])
24
+ response = Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
25
+ http.request request
26
+ end
27
+ end
28
+ response
22
29
  rescue *server_errors => e
23
30
  raise ConnectionError, e.message
24
31
  end
@@ -19,6 +19,7 @@ module Funky
19
19
  def extract_views_from(html)
20
20
  html.match(/<div><\/div><span class="fcg">\D*([\d,.]+)/)
21
21
  html.match %r{([\d,.]*?) views from this post} if $1.nil?
22
+ html.match /<div class=\"_1vx9\"><span>([\d,.]*?) Views<\/span><\/div>/ if $1.nil?
22
23
  matched_count $1
23
24
  end
24
25
 
data/lib/funky/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Funky
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler