Open noppanit opened 9 years ago
The login field has an id of u_0_v not u_0_x like you have in your code.
Try this:
login_button = sess.at_xpath('//*[@id="u_0_v"]')
It sounds like you have a problem with your Qt installation. I just used Homebrew: brew install qt
and it worked. You potentially have to install dryscrape after this.
What @trendsetter37 said might also be a problem, especially if the ID is randomized, in which case you need a different XPath expression to select the button.
@niklasb Yea I have ran into that before with randomized id's on login pages. However, I checked Facebook's login button and it was static as far as I could tell.
@trendsetter37 Thanks for the reply. I uninstall dryscrape
using pip uninstall dryscrape
and ran brew install qt
and reinstall dryscrape
again but I still see the same issue.
Hi @noppanit. I haven't seen this error before. Which version of Mac OS X are you using? And which version of Qt was installed by Homebrew?
@niklasb My OSX version is 10.10.5 and Qt is qt-4.8.7_1
hi @noppanit, Were you able to solve this? I'm having the same issue as well.
@KickingHorse no I wasn't able to solve it. I just gave up. It looks like Facebook doesn't like scraping.
Does the libQtWebKit.4.dylib
file even exist on your computers @KickingHorse @noppanit ?
It does. The problem I was having was my code would work from the command line but the IDEs I was using (PyCharm and Spyder) kept complaining about the error above :
dyld: Library not loaded: @rpath/./libQtWebKit.4.dylib
Referenced from: /Users/noppanit/.virtualenvs/envpy3/lib/python3.4/site-packages/webkit_server
Reason: image not found
Took me forever to figure it out, but eventually had to do something like this :
import os
os.environ.putenv('DYLD_FALLBACK_LIBRARY_PATH', '/Users/name/anaconda/lib/')
This ultimately fixed the problem for me.
This is where the file libQtWebKit.4.dylib
was actually stored after installing from PyCharm.
I'm not sure where brew -install qt
put these files as I was never able to find them.
I just tryed to run a simple dryscrape.Session(url)
and got the same error.
Just as @noppanit said, I got:
dyld: Library not loaded: /usr/local/opt/qt/lib/QtWebKit.framework/Versions/4/QtWebKit
I am on a Mac OS similar to @noppanits but i don
t have Homebrew installed, I am trying to use Mac Ports only.
When installing qt4-mac from mac ports, it does not install qt under /usr/local/opt
but rather /opt/local/libexec
So I created a symlink in /usr/local/opt
to libexec:
ln -s /opt/local/libexec/qt4 /usr/local/opt/qt
But dryscrape does not find the dyld file cause there is no such path.
Once I created the symlink, I searched for the missing /usr/local/opt/qt/lib/QtWebKit.framework/Versions/4/QtWebKit
But there`s none as I said:
$ ls /usr/local/opt/qt/lib | grep 'QtWebKit'
libQtWebKit.4.9.7.dylib
libQtWebKit.4.9.dylib
libQtWebKit.4.dylib
libQtWebKit.dylib
libQtWebKit.prl
Dryscrape is searching the following file:
$ port contents qt4-mac | grep 'QtWebKit.framework.*/4/QtWebKit'
/opt/local/libexec/qt4/Library/Frameworks/QtWebKit.framework/Versions/4/QtWebKit
Thats why that symlink won
t work, any ideas in how to solve this qt-dryscrape relationship?
Actually, there is a way to symlink it correctly but it is necessary to symlink each Qt 4 framework separately.
/usr/local/opt/qt/lib $:sudo ln -s /opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/ QtCore.framework
/usr/local/opt/qt/lib $:sudo ln -s /opt/local/libexec/qt4/Library/Framework/QtGui.framework/ QtGui.framework
/usr/local/opt/qt/lib $:sudo ln -s /opt/local/libexec/qt4/Library/Framework/QtNetwork.framework/ QtNetwork.framework
/usr/local/opt/qt/lib $:sudo ln -s /opt/local/libexec/qt4/Library/Framework/QtWebKit.framework/ QtWebKit.framework
This way it`s not necessary to download homebrew, which is nice cause there are some who use Fink or MacPorts and would rather avoid installing several package managers.
currectly, the login_button = sess.at_xpath('//*[@id="u_0_l"]')
, but I think you could try q.form().submit()
instead of finding the login button
I'm trying to use Dryscrape to login via Facebook. But I get these error.
Here's the code I'm using.