insta_scraper 0.4.0 → 0.5.0

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: 108e3e6f6e74ae178e1388e7725a54530ec59209
4
- data.tar.gz: 7ccc6fd5109681adf95e815eda57c444c37ed5fd
3
+ metadata.gz: 4039c631a9e86f78c8fb7b25f46e63fd23945d45
4
+ data.tar.gz: 807caaab6fc4daa7a4aa8967b525d2a9c446e073
5
5
  SHA512:
6
- metadata.gz: 6a51bcda446ffd5201d0a48edfa73f0f252e20b20c859da8e68611c8c5d645cfe2b5e91f9a5b33d8077b7e28b0886cb237114212b28dd5c4933abba2e5b46e6f
7
- data.tar.gz: 9218d8a7ae2579a1e86e565c66f617a06e4f33104554e10a8d5d780db75cdebd99762a0232bb85b396e27479fa31df6906e35c6ef167b4087f8afb724dd536e1
6
+ metadata.gz: b2ba575596682082d83e7c84549c0db54408007f7031ef469856b5988b8cc5315d4ac22247fba94c9840a057aa060efeb4ddc06f99e8ead3a5a3d606d5ec8795
7
+ data.tar.gz: 4f85446094701beb5ba1929adf6a3353d2f3d2aa1358331e6973224d0c9ca10c7678986777cd516d976940009b61293c6cbe326a2abbfb154f5590b8ca64796b
data/README.md CHANGED
@@ -70,6 +70,17 @@ account_media.data #=> #<Hashie::Mash...
70
70
  account_media.data.fetch('items') #=> [...]
71
71
  ```
72
72
 
73
+ * InstaScraper::JSON::MediaComment
74
+
75
+ ```ruby
76
+ media_comment = InstaScraper::JSON::MediaComment.new('BLeceL9BZNT', 17843235427151917, 20)
77
+ # shortcode, last_comment_id, per_page
78
+
79
+ media_comment.data #=> #<Hashie::Mash...
80
+ media_comment.data['comments']['nodes'] #=> [#<Hashie::Mash created_at=1476385792.0 id="17843206063151917" text="Now we can get the golden penis ship!"
81
+ ```
82
+
83
+
73
84
  ## Development
74
85
 
75
86
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -80,8 +91,10 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
80
91
 
81
92
  Bug reports and pull requests are welcome on GitHub at https://github.com/preciz/insta_scraper.
82
93
 
94
+ Ferenc Fekete
95
+ Extended gem with comment crawler class.
96
+
83
97
 
84
98
  ## License
85
99
 
86
100
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
87
-
data/lib/insta_scraper.rb CHANGED
@@ -13,3 +13,4 @@ require 'insta_scraper/json'
13
13
  require 'insta_scraper/json/account'
14
14
  require 'insta_scraper/json/media'
15
15
  require 'insta_scraper/json/account_media'
16
+ require 'insta_scraper/json/media_comment'
@@ -0,0 +1,24 @@
1
+ module InstaScraper
2
+ class JSON::MediaComment < InstaScraper::JSON
3
+ attr_reader :shortcode,
4
+ :last_comment_id,
5
+ :per_page
6
+
7
+ def initialize(shortcode, last_comment_id, per_page = 20)
8
+ @shortcode = shortcode
9
+ @last_comment_id = last_comment_id
10
+ @per_page = per_page
11
+ end
12
+
13
+ def url
14
+ "https://www.instagram.com/query/?q=ig_shortcode(#{shortcode}){comments.before(#{last_comment_id},#{per_page}){count,nodes{id,created_at,text,user{id,profile_pic_url,username,follows{count},followed_by{count},biography,full_name,media{count},is_private,external_url,is_verified}},page_info}}"
15
+ end
16
+
17
+ def data
18
+ @data ||=
19
+ Hashie::Mash.new(::JSON.parse(raw_json))
20
+ .extend(Hashie::Extensions::DeepFetch)
21
+ .extend(Hashie::Extensions::DeepFind)
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module InstaScraper
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insta_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - preciz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -89,6 +89,7 @@ files:
89
89
  - lib/insta_scraper/json/account.rb
90
90
  - lib/insta_scraper/json/account_media.rb
91
91
  - lib/insta_scraper/json/media.rb
92
+ - lib/insta_scraper/json/media_comment.rb
92
93
  - lib/insta_scraper/version.rb
93
94
  homepage:
94
95
  licenses: