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 +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/funky/html/page.rb +8 -1
- data/lib/funky/html/parser.rb +1 -0
- data/lib/funky/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cb6573c5c4307f5428f7f8d49bc59d61725e580
|
4
|
+
data.tar.gz: 93da0ce27c0889babb4223e6556ea0fcb0339ebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/funky/html/page.rb
CHANGED
@@ -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
|
data/lib/funky/html/parser.rb
CHANGED
@@ -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
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.
|
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-
|
11
|
+
date: 2017-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|