Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I log in to YouTube using Perl?
    text
    copied!<p>I am trying to write a Perl script to connect to me YouTube account but it doesnt seem to work. Basically I just want to connect to my account but apparently it is not working. I don't even have an idea on how I could debug this! Maybe it is something related to https protocol?</p> <p>Please enlighten me! Thanks in advance.</p> <pre><code>use HTTP::Request::Common; use LWP::UserAgent; use strict; my $login="test"; my $pass = "test"; my $res = ""; my $ua = ""; # Create user agent, make it look like FireFox and store cookies $ua = LWP::UserAgent-&gt;new; $ua-&gt;agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051213 Firefox/1.0.7"); $ua-&gt;cookie_jar ( {} ); # Request login page $res = $ua-&gt;request(GET "https://www.google.com/accounts/ServiceLogin?service=youtube&amp;hl=en_US&amp;passive=true&amp;ltmpl=sso&amp;uilel=3&amp;continue=http%3A//www.youtube.com/signup%3Fhl%3Den_US%26warned%3D%26nomobiletemp%3D1%26next%3D/index"); die("ERROR1: GET http://www.youtube.com/login\n") unless ($res-&gt;is_success); # Now we login with our user/pass $res = $ua-&gt;request( POST "https://www.google.com/accounts/ServiceLoginAuth?service=youtube", Referer =&gt; "http://www.youtube.com/login", Content_Type =&gt; "application/x-www-form-urlencoded", Content =&gt; [ currentform =&gt; "login", next =&gt; "/index", username =&gt; $login, password =&gt; $pass, action_login =&gt; "Log+In" ] ); # YouTube redirects (302) to a new page when login is success # and returns OK (200) if the login failed. #die("ERROR: Login Failed\n") unless ($res-&gt;is_redirect()); print $res-&gt;content; </code></pre> <hr> <p>what i am doing is learning the web features of perl, so i dont want to use any library except wwwlib or mechanize to get the job done. how can i just connect to my account using a perl script? this is my objective for now hope someone can post a script or correct mine. thank you guys for you help. i am testing Webscarab now..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload