4 ms·
>>For instance, is there a way to programmatically get the list of all articles I've ever upvoted (the "Saved" page)? I always thought part of the fun was havi
by coderdude 15y ago
>>For instance, is there a way to programmatically get the list of all articles I've ever upvoted (the "Saved" page)?
I always thought part of the fun was having to hack together an ad hoc script to grab the data you wanted. That's the "hacker" way, isn't it? ;)
- sigil 15y agoSure, scraping works for operations that don't require login. But we're seeing more and more "apps for HN," and it would be nice if they could authenticate and do nifty things without me giving up my HN password.
- pestaa 15y agoYou aren't giving up your password - the session does not leave your computer.
- coderdude 15y agoScraping works for operations that require login as well. You just have to start with the login process and hold onto the cookie it gives you after you post to the login form. As long as you continue to send your cookie along with each request you'll be able to access any information you want, as well as automate things like voting (not recommended). I haven't seen anything that asks for my HN password yet. Usually they just ask you to create a separate account with them and will scrape your profile looking for an authentication string to verify your HN account. What apps are you referring to? Edit: Nevermind, you're referring to scraping only working in scenarios where you're the one doing the scraping -- not some external service. In that case, an API would be useful. I'm not sure about the usefulness of the apps though...
- jpb0104 15y agoHere is my crack at a PHP version of this: http://pastie.org/2371425 http://pastie.org/2371425 Requires Goutte: https://github.com/fabpot/Goutte https://github.com/fabpot/Goutte