Closed gchiaren closed 7 years ago
The gem includes capybara and poltergeist as dependencies, do you also have them included in your gemfile? Maybe a potential version mismatch? Try removing your own instance of capybara if thats the case and see if it still behaves. Let me know if you have any success -- otherwise I can look into this further for you. @gchiaren
Yes, I have capybara (2.7.1)
and poltergeist (1.9.0)
in my bundle. I can see those aren't the latest versions of those gems, but based on the gemspec they're what you recommend.
I can try explicitly including them in my gemfile as you suggested, and report back with the results.
No luck. I tried installing the latest versions of capybara and poltergeist, followed by insta_scrape, and that made insta_scrape completely not work. For some reason it installed version 0.1.0 of insta_scrape, and running InstaScrape.user_info("foofighters")
yielded:
NoMethodError: undefined method 'user_info' for InstaScrape:Class
Remove them as dependencies from your app. Instascrape installs them on its own.
Do you have a repo I can look at? @gchiaren
@dannyvassallo I unfortunately can't as it's private. :/ Happy to share any relevant parts of it however, anything you think that might help?
Remove those gems. Install just instascrape. Don't include capybara or poltergeist in your gemfile. Let me know how that goes.
That's what I did initially, and it implicitly installed the dependencies capybara (2.7.1)
and poltergeist (1.9.0)
, as I would expect.
Do you also have phantomjs installed as a dependency?
Yes, I saw that was a dependency, so I installed it via homebrew before installing insta_scrape.
All of the gem dependencies required for instascrape are bundled with instascrape. You don't need to install anything extra. Remove any gems that are listed as dependencies for instascrape and then you should be fine. It sounds like you're causing version conflicts by double including the gems that instascrape requires. It works by itself. You don't need to install anything BUT instascrape.
On Jun 1, 2017 11:02 AM, "gchiaren" notifications@github.com wrote:
Yes, I saw that was a dependency, so I installed it via homebrew before installing insta_scrape.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dannyvassallo/insta_scrape/issues/18#issuecomment-305521320, or mute the thread https://github.com/notifications/unsubscribe-auth/AFk4r54BmrhARNH8hivvDsJz9h_bTXjQks5r_tKYgaJpZM4Nr7YT .
Ok, I have more details:
I went back and looked at the sequence of events when I first added insta_scrape to my gemfile. When I did bundle install
, along with installing insta_scrape 1.1.2
it automatically included the dependencies: phantomjs 2.1.1.0
, capybara 2.7.1
, and poltergeist 1.9.0
.
I then fired up a console session and ran my first insta_scrape command, InstaScrape.user_posts("foofighters")
. It auto-installed Phantomjs then immediately went into the same error, like so:
Phantomjs does not appear to be installed in /Users/me/.phantomjs/2.1.1/darwin/bin/phantomjs, installing!
...
Successfully installed phantomjs. Yay!
Removed temporarily downloaded files.
Capybara::Poltergeist::JavascriptError: Capybara::Poltergeist::JavascriptError
from /Users/me/.rvm/gems/ruby-2.3.1/gems/poltergeist-1.9.0/lib/capybara/poltergeist/browser.rb:351:in `command'
from /Users/me/.rvm/gems/ruby-2.3.1/gems/poltergeist-1.9.0/lib/capybara/poltergeist/browser.rb:34:in `visit'
from /Users/me/.rvm/gems/ruby-2.3.1/gems/poltergeist-1.9.0/lib/capybara/poltergeist/driver.rb:95:in `visit'
from /Users/me/.rvm/gems/ruby-2.3.1/gems/capybara-2.7.1/lib/capybara/session.rb:233:in `visit'
from /Users/me/.rvm/gems/ruby-2.3.1/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
from /Users/me/.rvm/gems/ruby-2.3.1/gems/insta_scrape-1.1.2/lib/insta_scrape.rb:173:in `scrape_user_posts'
from /Users/me/.rvm/gems/ruby-2.3.1/gems/insta_scrape-1.1.2/lib/insta_scrape.rb:48:in `user_posts'
To make sure I did not double include anything, I fired up a new rails project with a clean gemset, and ONLY added the insta_scrape gem to the gemfile. I did a bundle install, started a console session, ran an insta_scrape command, and same error :(
Not sure if this made any difference, but I updated the app to Rails 5.1.0. Tried again, and 1 out of 9 attempts actually worked. The fact that it's not a 100% failure rate is peculiar. Does it work 100% of the time when you try it, @dannyvassallo?
I've dig into this and found that its throwing a javascript error on Instagram side sometimes. If you catch the JavascriptError exception;
Its contents are;
#<Capybara::Poltergeist::JSErrorItem:0x000000036bf2d0 @message="Facebook Pixel Error: ReferenceError: Can't find variable: Set", @stack="Facebook Pixel Error: ReferenceError: Can't find variable: Set\n at https://connect.facebook.net/en_US/fbevents.js:24 in fc">]
So, js_errors option should be passed to the driver initialization at: https://github.com/dannyvassallo/insta_scrape/blob/master/lib/init/poltergeist.rb#L2
@gchiaren this is in the new release 1.1.3
I added insta_scrape 1.1.2 to my current Rails project, Rails 5.0.3 with ruby 2.3.1p112. When trying to run any insta_scrape methods from a console session, I get the following error:
In this particular instance I ran
InstaScrape.user_info("foofighters")
.Interestingly, if I go to line 105 of
insta_scrape.rb
and runextend Capybara::DSL
followed byvisit "https://www.instagram.com/foofighters/"
, occasionally it works, and occasionally it throws the same error.What could be the issue?