insta_scraper 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/lib/insta_scraper.rb +1 -0
- data/lib/insta_scraper/json/media_comment.rb +24 -0
- data/lib/insta_scraper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4039c631a9e86f78c8fb7b25f46e63fd23945d45
|
4
|
+
data.tar.gz: 807caaab6fc4daa7a4aa8967b525d2a9c446e073
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -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
|
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
|
+
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-
|
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:
|