-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Selenium for private groups #28
Comments
Hmm, interesting. Initially I tried using mechanize, which handles cookies like this automatically, but I couldn't get it to successfully login - probably the login page used too much JavaScript for it. It didn't appear to work on PhantomJS either, which is interesting. If you can find a way to get that cookie data without using Selenium, i.e. mechanize or some other alternative, I'll gladly merge that PR. I'll leave the issue open for now pending me eventually looking into this. But as it currently works for me it's not too likely to be soon, hehe. |
The purpose of me filing that issue was really more just to bring the fact I'm afraid the only way I know of getting the cookie data is to manually On 5 August 2016 at 21:28, Claudiu [email protected] wrote:
|
Ahh okay, understood. Thanks, I appreciate the info! Fair point about GitHub not supporting comments, also. I will still leave the issue open pending more investigation since I would indeed prefer it to not have to use Selenium and open a Firefox window... we shall see. |
Doesn't Selenium also support the headless HtmlUnit driver? It may render On 5 August 2016 at 22:06, Claudiu [email protected] wrote:
|
Hmm! Interesting. Thanks to @bitstein there's an option to pick which webdriver to use. I tried it briefly with PhantomJS and it didn't seem to work - maybe HtmlUnit will succeed where it failed, or I may have been doing something silly when I tried PhantomJS. |
Selenium is not required for private groups. Cookies can be used as an alternative.
How to do this:
1.) Login to the Yahoo account that is subscribed to the private group in a web browser
2.) Get a valid Netscape-format cookies.txt file from the browser (in FireFox, the extension Export Cookies will let you do this through Tools > Export Cookies... once it is installed.
3.) Try out the following python script (python 2) changing the name of the group in the API to a private one that your Yahoo account is subscribed to:
import cookielib, urllib2
cj = cookielib.MozillaCookieJar()
cj.load("cookies.txt")
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
r = opener.open("https://groups.yahoo.com/api/v1/groups/HudsonValleyEcycle/messages/1/raw")
f = open("data.json", "wb")
f.write(r.read())
f.close()
(presuming that the cookie file you downloaded is called 'cookies.txt' and in the same dir as the python script
4.) Bonus: if you want, remove all the cookies in the cookie file except the two from the domain ".yahoo.com" called T and Y. Those are the two that handle login info.
The text was updated successfully, but these errors were encountered: