insta_scrape 1.1.1 → 1.1.2
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/README.md +8 -3
- data/lib/init/poltergeist.rb +3 -1
- data/lib/insta_scrape.rb +5 -3
- data/lib/insta_scrape/version.rb +1 -1
- data/lib/models/instagram_post.rb +3 -2
- 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: 789745dba3f0aec6de0b2d01d9bff151cf9cf8ca
|
4
|
+
data.tar.gz: ca9584f98624278aec6d4579c9f7609a5a678e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b25877f743ac994344209970a9ba2b9d3626fe7a5b1ec973b4abe69487c58ed4e5568ac27536c271a1c1e77ce1c56b8d2a938f0df0615712ea61a42c48d37916
|
7
|
+
data.tar.gz: 0ecfd826b132099e6117b15a793ce09a9e7cd3ba1ff2e801466aae10be2310b5539ddd037ee9872c83166883c9c984ba09bff77a7ce2e93ae6179db7e6fc069e
|
data/README.md
CHANGED
@@ -3,13 +3,17 @@
|
|
3
3
|

|
4
4
|
# InstaScrape
|
5
5
|
|
6
|
-
A ruby scraper for instagram in
|
6
|
+
A ruby scraper for instagram in 2017. Because the hashtag deprecation in the API is just silly.
|
7
7
|
This gem is dependent on Capybara, PhantomJS, and Poltergeist.
|
8
8
|
|
9
9
|
Using this gem you can access multiple facets of the instagram API without needing authorization, most importantly the hashtag.
|
10
10
|
|
11
|
+
```shell
|
12
|
+
#UPDATES
|
13
|
+
v.1.1.2 text from images is now a default part of the post object & international support bugfix
|
14
|
+
v.1.1.1 introducing optional metadata!
|
11
15
|
v.1.1.0 introducing "long_scrape" methods! Now with more instagram posts!
|
12
|
-
|
16
|
+
```
|
13
17
|
|
14
18
|
## Note
|
15
19
|
|
@@ -51,7 +55,7 @@ the following option as a second or third argument on most methods:
|
|
51
55
|
|
52
56
|
For Example:
|
53
57
|
|
54
|
-
```
|
58
|
+
```ruby
|
55
59
|
InstaScrape.hashtag("foofighters", include_meta_data: true)
|
56
60
|
|
57
61
|
#OR
|
@@ -111,6 +115,7 @@ scrape_result = InstaScrape.hashtag("test")
|
|
111
115
|
scrape_result.each do |post|
|
112
116
|
puts post.image
|
113
117
|
puts post.link
|
118
|
+
puts post.text
|
114
119
|
end
|
115
120
|
```
|
116
121
|
|
data/lib/init/poltergeist.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
Capybara.register_driver :poltergeist do |app|
|
2
|
-
|
2
|
+
driver = Capybara::Poltergeist::Driver.new(app, :phantomjs => Phantomjs.path)
|
3
|
+
driver.add_header('Accept-Language', 'en')
|
4
|
+
driver
|
3
5
|
end
|
4
6
|
|
5
7
|
Capybara.default_driver = :poltergeist
|
data/lib/insta_scrape.rb
CHANGED
@@ -74,19 +74,21 @@ module InstaScrape
|
|
74
74
|
|
75
75
|
private
|
76
76
|
#post iteration method
|
77
|
+
|
77
78
|
def self.iterate_through_posts(include_meta_data:)
|
78
79
|
posts = all("article div div div a").collect do |post|
|
79
80
|
{ link: post["href"],
|
80
|
-
image: post.find("img")["src"]
|
81
|
+
image: post.find("img")["src"],
|
82
|
+
text: post.find("img")["alt"]}
|
81
83
|
end
|
82
84
|
|
83
85
|
posts.each do |post|
|
84
86
|
if include_meta_data
|
85
87
|
visit(post[:link])
|
86
88
|
date = page.find('time')["datetime"]
|
87
|
-
info = InstaScrape::InstagramPost.new(post[:link], post[:image], date)
|
89
|
+
info = InstaScrape::InstagramPost.new(post[:link], post[:image], date, text)
|
88
90
|
else
|
89
|
-
info = InstaScrape::InstagramPost.new(post[:link], post[:image])
|
91
|
+
info = InstaScrape::InstagramPost.new(post[:link], post[:image], text)
|
90
92
|
end
|
91
93
|
@posts << info
|
92
94
|
end
|
data/lib/insta_scrape/version.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
class InstaScrape::InstagramPost
|
2
|
-
attr_accessor :link, :image, :date
|
3
|
-
def initialize(link, image, date=nil)
|
2
|
+
attr_accessor :link, :image, :date, :text
|
3
|
+
def initialize(link, image, date=nil, text=nil)
|
4
4
|
@image = image
|
5
5
|
@link = link
|
6
6
|
@date = date
|
7
|
+
@text = text
|
7
8
|
end
|
8
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insta_scrape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dannyvassallo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|