[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Seeking some guidance with net/http

Dan Diebolt

4/4/2008 12:57:00 AM

[Note: parts of this message were removed to make it a legal post.]

Try this: http://rubyforge.org/projec...

4 Answers

Andrew Cowan

4/4/2008 1:29:00 AM

0

Dan Diebolt wrote:
> Try this: http://rubyforge.org/projec...
>
>
Dan, like the youtube-g lib this one also provides no means for
authenticating a Youtube account. Though this does provide some
interesting options that can help me in some respects, it doesn't
provide me with the same functionality that I can have as if I were
actually logged into the website, which I am trying to emulate.

Thanks
-Andy

Shawn Anderson

4/4/2008 1:53:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

This worked for me:

require 'rubygems'
require 'mechanize'

user = "user_here"
pw = "password_here"
agent = WWW::Mechanize.new
page = agent.post 'http://youtube.com/s...,
{"username"=>user,"password"=>pw,"current_form"=>"loginForm","action_login"=>"Log+In"}
page = agent.get 'http://youtube...
# this returns true, showing you are logged in
p page.body.to_s.include?("/user/#{user}")



On Thu, Apr 3, 2008 at 6:28 PM, Andrew Cowan <icculus@gmdstudios.com> wrote:

> Dan Diebolt wrote:
>
> > Try this: http://rubyforge.org/projec...
> >
> >
> >
> Dan, like the youtube-g lib this one also provides no means for
> authenticating a Youtube account. Though this does provide some interesting
> options that can help me in some respects, it doesn't provide me with the
> same functionality that I can have as if I were actually logged into the
> website, which I am trying to emulate.
>
> Thanks
> -Andy
>
>

Andrew Cowan

4/4/2008 2:21:00 AM

0

Shawn, I had not heard of the mechanize lib, but sure enough it works
great. Thank you for posting that, much appreciated!

Thanks
-Andy


Shawn Anderson wrote:
> This worked for me:
>
> require 'rubygems'
> require 'mechanize'
>
> user = "user_here"
> pw = "password_here"
> agent = WWW::Mechanize.new
> page = agent.post 'http://youtube.com/s...,
> {"username"=>user,"password"=>pw,"current_form"=>"loginForm","action_login"=>"Log+In"}
> page = agent.get 'http://youtube...
> # this returns true, showing you are logged in
> p page.body.to_s.include?("/user/#{user}")
>
>
>
> On Thu, Apr 3, 2008 at 6:28 PM, Andrew Cowan <icculus@gmdstudios.com> wrote:
>
>
>> Dan Diebolt wrote:
>>
>>
>>> Try this: http://rubyforge.org/projec...
>>>
>>>
>>>
>>>
>> Dan, like the youtube-g lib this one also provides no means for
>> authenticating a Youtube account. Though this does provide some interesting
>> options that can help me in some respects, it doesn't provide me with the
>> same functionality that I can have as if I were actually logged into the
>> website, which I am trying to emulate.
>>
>> Thanks
>> -Andy
>>
>>
>>
>
>


7stud --

4/4/2008 3:59:00 AM

0

Andrew Cowan wrote:
> Shawn, I had not heard of the mechanize lib, but sure enough it works
> great. Thank you for posting that, much appreciated!
>
> Thanks
> -Andy

perl has mechanize too.
--
Posted via http://www.ruby-....