insta_scrape 1.1.1 → 1.1.2

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: 0c55fecbadd0f789dfa52d2d26dab8175fb7acdd
4
- data.tar.gz: ed3fa91e7b6422f435e6095d67a5abb175702b41
3
+ metadata.gz: 789745dba3f0aec6de0b2d01d9bff151cf9cf8ca
4
+ data.tar.gz: ca9584f98624278aec6d4579c9f7609a5a678e51
5
5
  SHA512:
6
- metadata.gz: 135f7ac6592b5a7f03d04874af4341f472d9e30b6e6378a6a6219ef2854fdba2f4f4a494d1ab3daa5145a7c36f7d5a4722cf6723b74920453dca7ce2b31f4426
7
- data.tar.gz: 13287580a7b8731f3ffaa29cfe4b2acec51bb14d40e76bed5d4af2b16ce74a613860d268f245c776c25f8a227bc1b85591553081ef21d2cff2b81432527dc4e0
6
+ metadata.gz: b25877f743ac994344209970a9ba2b9d3626fe7a5b1ec973b4abe69487c58ed4e5568ac27536c271a1c1e77ce1c56b8d2a938f0df0615712ea61a42c48d37916
7
+ data.tar.gz: 0ecfd826b132099e6117b15a793ce09a9e7cd3ba1ff2e801466aae10be2310b5539ddd037ee9872c83166883c9c984ba09bff77a7ce2e93ae6179db7e6fc069e
data/README.md CHANGED
@@ -3,13 +3,17 @@
3
3
  ![alt text](https://s3-us-west-2.amazonaws.com/instascrape/instascrapelogo.png "logo")
4
4
  # InstaScrape
5
5
 
6
- A ruby scraper for instagram in 2016. Because the hashtag deprecation in the API is just silly.
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
- v.1.1.1 introducing "long_scrape" methods! Now with more instgram posts!
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
 
@@ -1,5 +1,7 @@
1
1
  Capybara.register_driver :poltergeist do |app|
2
- Capybara::Poltergeist::Driver.new(app, :phantomjs => Phantomjs.path)
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
@@ -1,3 +1,3 @@
1
1
  module InstaScrape
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -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.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: 2016-12-14 00:00:00.000000000 Z
11
+ date: 2017-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler