funky 0.2.30 → 0.2.31

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: 6b53cf7d46fc1e0239f652d63baa3002070d88d1
4
- data.tar.gz: 456d2a4815de31838938dd5a03aa0bb2921c0923
3
+ metadata.gz: 373e82d2fac5a97e061528f2eba025d91ba52471
4
+ data.tar.gz: 96ba0e310787da082ff15b1693244741e94cc7a9
5
5
  SHA512:
6
- metadata.gz: ce499b710cfb8d6377f83677c2aa30fee846b78bd91f34c18b2b4352219f817d7178a1a82b5a337c308bc0639c038682dc658233ee74a9d760bcb849924b1c1a
7
- data.tar.gz: 48bd3bdf6dd9d82c24bbd2801aa2f3f2d8ab11716dcada877383c7def50674c88834a57dfe653fe4d060551b29a3a1c18f7a8e08d9e53433d8d101a39a4e6a9b
6
+ metadata.gz: ef2fa550ac6d8745feae58ab983e45f092b464458cb42f48e37657a0361e1c9ab9fd65223a44f4bb17649637ae8e85547e230a383a6759e8d52517271f82d696
7
+ data.tar.gz: 98fbb7ee4a9205be896d3d027b05587748e83c0970dabcc9455e351cbd5722575dcc2a673f04b178310642a50b34cad89dc2883d897c9837c0d56d5937182078
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ 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.31 - 2017/10/25
10
+
11
+ * [BUGFIX] Revert the change of version 0.2.29 and do not use request to get app
12
+ access token.
13
+ * [ENHANCEMENT] Allow funky to scrape view count for more videos, by changing
14
+ the way how to scrape.
15
+
9
16
  ## 0.2.30 - 2017/10/16
10
17
 
11
18
  * [BUGFIX] Test should pass when call Page#videos. Partly revert the change
@@ -8,7 +8,7 @@ module Funky
8
8
  module Connection
9
9
  class API < Base
10
10
  def self.fetch_all(path_query)
11
- uri = URI "https://#{host}/v2.9/#{path_query}&limit=100&access_token=#{app_access_token}"
11
+ uri = URI "https://#{host}/v2.9/#{path_query}&limit=100&access_token=#{app_id}%7C#{app_secret}"
12
12
  fetch_data_with_paging_token(uri)
13
13
  end
14
14
 
@@ -24,7 +24,7 @@ module Funky
24
24
  end
25
25
 
26
26
  def self.fetch(path_query, is_array: false)
27
- uri = URI "https://#{host}/v2.8/#{path_query}&limit=100&access_token=#{app_access_token}"
27
+ uri = URI "https://#{host}/v2.8/#{path_query}&limit=100&access_token=#{app_id}%7C#{app_secret}"
28
28
  is_array ? fetch_multiple_pages(uri).uniq : json_for(uri)
29
29
  rescue URI::InvalidURIError
30
30
  raise Funky::ContentNotFound, "Invalid URL"
@@ -66,14 +66,14 @@ module Funky
66
66
  def self.request(id:, fields:)
67
67
  uri = URI::HTTPS.build host: host,
68
68
  path: "/v2.8/#{id}",
69
- query: "access_token=#{app_access_token}&fields=#{fields}"
69
+ query: "access_token=#{app_id}%7C#{app_secret}&fields=#{fields}"
70
70
  response_for(get_http_request(uri), uri)
71
71
  end
72
72
 
73
73
  def self.batch_request(ids:, fields:)
74
74
  uri = URI::HTTPS.build host: host,
75
75
  path: "/",
76
- query: "include_headers=false&access_token=#{app_access_token}"
76
+ query: "include_headers=false&access_token=#{app_id}%7C#{app_secret}"
77
77
  batch = create_batch_for ids, fields
78
78
  http_request = post_http_request uri
79
79
  http_request.set_form_data batch: batch.to_json
@@ -94,14 +94,6 @@ module Funky
94
94
  Funky.configuration.app_secret
95
95
  end
96
96
 
97
- def self.app_access_token
98
- @app_access_token ||= begin
99
- uri = URI::HTTPS.build host: host, path: "/v2.8/oauth/access_token",
100
- query: URI.encode_www_form({client_id: app_id, client_secret: app_secret, grant_type: 'client_credentials'})
101
- Funky::Connection::API.json_for(uri)[:access_token]
102
- end
103
- end
104
-
105
97
  def self.post_http_request(uri)
106
98
  Net::HTTP::Post.new uri
107
99
  end
@@ -4,10 +4,11 @@ module Funky
4
4
  class Page
5
5
  def get(video_id:)
6
6
  body = response_for(video_id).body
7
- if body.include? '<meta name="description"'
8
- body
9
- else
7
+
8
+ if body.include? '<title id="pageTitle">Facebook</title>'
10
9
  raise ContentNotFound, 'Please double check the ID and try again.'
10
+ else
11
+ body
11
12
  end
12
13
  end
13
14
 
data/lib/funky/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Funky
2
- VERSION = "0.2.30"
2
+ VERSION = "0.2.31"
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.30
4
+ version: 0.2.31
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-10-16 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler