1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Youtube login refresh bug

Discussion in 'C, C++, C#' started by ilPatrino, Apr 16, 2012.

Tags:
  1. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    Guys I'm developing a bot in the moment which requires lots of accounts to login to youtube.

    I use public proxies provided here on BHW, test if youtube page shows up with each proxy, then I try to bind the "good" proxies to the accounts.

    I am noticing that with most of the proxies, when the bot tries to post the login data, the page just refreshes the login page, nothing happens. I know its not the accounts since they do work with some proxies but it takes lots of time to bind these proxies to the accounts so I want to overcome this problem.

    I was searching online & it seems that youtube have some login problems
    http://www.google.com.mt/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&ved=0CEEQFjAE&url=http%3A%2F%2Fwww.google.co.uk%2Fsupport%2Fforum%2Fp%2Fyoutube%2Fthread%3Ftid%3D53922c1138105370%26hl%3Den&ei=fXaMT9XKFcLKtAaA6eisCw&usg=AFQjCNET9J6jTxl8jjkYsoPfVERJ4jWp6Q


    Has anybody worked around this? I would appreciate a solution.
     
  2. shurk

    shurk Junior Member

    Joined:
    Feb 2, 2011
    Messages:
    122
    Likes Received:
    45
    I'm guessing your bot utilizes a browser to login then? One of the people complaining in the link you posted says that all their accounts work when logging in using an 'Anonymous' session (I'm guessing they mean 'Incognito' in Chrome or 'Private Browsing' in Firefox). You could try and make your bot utilize an Incognito browser session?
     
  3. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    No I actually use HttpWebRequest in C# so its not a browser after all, Im sure its not caching anything & the cookies are new for each session.
     
  4. shurk

    shurk Junior Member

    Joined:
    Feb 2, 2011
    Messages:
    122
    Likes Received:
    45
    They do state that it is cookie based. You could try rotating different User Agents if your not already? But considering they are giving links to pages showing how to clear the cache for the 4 major browsers, I doubt it would help.

    The only thing I can think of is this; if this login problem is limited to just youtube, then you could try to login via a different page (Perhaps Accounts?) so that you get the 'logged in' cookie, then load youtube? I personally have never had a problem logging into youtube, but I never login on the homepage, I'm always logged on from gmail when I load it.

    Also, if that works, you could rotate the login location to lower your footprint a bit ;)
     
  5. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    Ill try that mate thanks
     
  6. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    Still doing the same from other services, remember that google now have the same login page for all the services, I quite dont understand whats wrong here.
     
  7. roster67

    roster67 Registered Member

    Joined:
    Mar 27, 2012
    Messages:
    69
    Likes Received:
    10
    There could be many causes to your problem as we cant see your code.

    Most of public proxies will modificate your original POST method headers and/or your proxy setting.
    Others are blacklisted by Google.

    Simple workaround is to use private proxies wich are not use by other third party.
    Of course, that will limit dramatically number of your available proxies.

    There are others solutions but thats envolve hacking, so I'll not discuss it here, sorry!
     
  8. calebmann

    calebmann Power Member Premium Member

    Joined:
    Sep 12, 2010
    Messages:
    541
    Likes Received:
    298
    Occupation:
    FULL TIME INTERNET
    Location:
    Digitopia


    Yea, better to not..
     
  9. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    Ok so what I did was debug the application & grabbed one of the "bad" proxies, Then I used the same account & same proxy to login using chrome and it worked. If it's something with the proxy, that wouldn't have worked right?
     
  10. Mr.Profit

    Mr.Profit Regular Member

    Joined:
    Dec 22, 2009
    Messages:
    219
    Likes Received:
    471
    Occupation:
    Marketer and SEO
    Location:
    Internet
    Home Page:
    As far as I can tell, it's not the proxy, but the request you're making.

    1) try to make a get request to http://youtube.com (this way you'll have a session cookie form YT)
    2) navigate to the login page (with referer youtube.com)
    3) post the login (allow redirects)
    4) check if you've logged in

    Knowing nothing about your code, I guess it has something to do with referers and the request properties.

    Another option, to know EXACTLY what's different is to use HTTP Analyzer and make one request from your bot, and one form your browser, after that just compare the requests made and the responses.

    Regards,
    Mr.Profit
     
  11. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    I used tubenoia as reference to build this bot, Im sure that the headers & post data are correct as I compared them with reuests made with normal browser, But Ill try as you suggested above and see what happens
     
  12. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    I just tried logging in with one of the accounts using the bot but this time without proxies and it seems its doing it as well so its defiantly the bot, the thing is that it seems to be working at times but most of the time it just doesn't. I'm going to go into more depth & try to solve this.
     
  13. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    Ok guys, So I've broken it to this:I made a request with the bot & took the html of the login page from there & put it in a test.html file in the desktop. I Opened with chrome & tried to login only to get the same result, the page just refreshes.

    So then I went to youtube's login page using a normal browser(instead of the bot), Saved the HTML generated in the same test.html file & tried to login through there and guess what???? It logged in.

    So I guess the problem lies with HttpWebRequest since it does not execute javascript.

    Anyway I can go around this guys?
     
  14. izSpK

    izSpK BANNED BANNED

    Joined:
    Sep 5, 2010
    Messages:
    1,546
    Likes Received:
    1,666
    Tubenoia's login code uses old POST data. Grab the new one and create a bot from that. If you're too lazy, here (this one also accepts the privacy policy change page if it comes up):
    Code:
    Public Function Login() As Boolean
            If IsNothing(_Username) Or IsNothing(_Password) Then Return False
            'Request.SetProxy("184.22.53.73", 808, True, "test", "test")
    
            Dim Html As String
            Html = Request.httpGet("http://www.youtube.com/")
            If Html.Contains("machid") Then
                Dim loginUrl As String
                loginUrl = GetBetween(Html, "<div id=\""masthead-user\"">", "<\/div>", 0, True)
                loginUrl = HtmlDecode(GetBetween(loginUrl, "<a class=""end"" href=""", """>", 0, True))
                Html = Request.httpGet(loginUrl)
                Dim _postData As New StringBuilder
                _postData.Append("continue=" & UrlEncode(HtmlDecode(GetBetween(Html, "id=""continue"" value=""", """", 0, True))))
                _postData.Append("&service=youtube")
                _postData.Append("&uilel=" & UrlEncode(HtmlDecode(GetBetween(Html, "id=""uilel"" value=""", """", 0, True))))
                _postData.Append("&dsh=" & UrlEncode(HtmlDecode(GetBetween(Html, "id=""dsh"" value=""", """", 0, True))))
                _postData.Append("&ltmpl=" & UrlEncode(HtmlDecode(GetBetween(Html, "id=""ltmpl"" value=""", """", 0, True))))
                _postData.Append("&hl=" & UrlEncode(HtmlDecode(GetBetween(Html, "id=""hl"" value=""", """", 0, True))))
    
                Dim GALX As String = GetBetween(Html, "name=""GALX""", ">", 0, True)
                GALX = GetBetween(GALX, "value=""", """", 0, True)
                _postData.Append("&GALX=" & GALX)
    
                Dim pstMsg As String = GetBetween(Html, "name=""pstMsg""", ">", 0, True)
                pstMsg = GetBetween(pstMsg, "value=""", """", 0, True)
                _postData.Append("&pstMsg=" & pstMsg)
    
                _postData.Append("&dnConn=")
    
                Dim checkConnection As String = GetBetween(Html, "name=""checkConnection""", ">", 0, True)
                checkConnection = GetBetween(checkConnection, "value=""", """", 0, True)
                _postData.Append("&checkConnection=" & UrlEncode(checkConnection))
    
                Dim checkedDomains As String = GetBetween(Html, "name=""checkedDomains""", ">", 0, True)
                checkedDomains = GetBetween(checkedDomains, "value=""", """", 0, True)
                _postData.Append("&checkedDomains=" & UrlEncode(checkedDomains))
    
                Dim timeStmp As String = GetBetween(Html, "id=""timeStmp""", ">", 0, True)
                timeStmp = GetBetween(timeStmp, "value='", "'", 0, True)
                _postData.Append("&timeStmp=" & UrlEncode(timeStmp))
    
                Dim secTok As String = GetBetween(Html, "id=""secTok""", ">", 0, True)
                secTok = GetBetween(secTok, "value='", "'", 0, True)
                _postData.Append("&secTok=" & UrlEncode(secTok))
    
                _postData.Append("&Email=" & UrlEncode(_Username))
                _postData.Append("&Passwd=" & UrlEncode(_Password))
    
                _postData.Append("&signIn=Sign+in")
                _postData.Append("&PersistentCookie=yes")
                _postData.Append("&rmShown=1")
    
                Html = Request.httpPost("https://accounts.google.com/ServiceLoginAuth", _postData.ToString)
    Check:      If Html.Contains("location.replace") Then
                    Dim redirectUrl As String = GetBetween(Html, "'", "'", 0, True)
                    Html = Request.httpGet(UrlDecode(redirectUrl))
                ElseIf Html.Contains("value=""OK, got it""") Then
                    Html = Request.httpPost("https://accounts.google.com/b/0/NewPrivacyPolicy", "service=youtube&continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dheader%26nomobiletemp%3D1%26hl%3Den_US%26next%3D%252F&submitbutton=OK%2C+got+it")
                    Debug.WriteLine("Accepted privacy policy on: " & _Username)
                    GoTo Check
                End If
                If Html.Contains("Sign out") Then
                    Return True
                Else
                    Return False
                End If
            Else
                Return False
            End If
        End Function
     
    • Thanks Thanks x 1
  15. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    Thanks SPK I'll try it later, you're the man.
     
  16. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    SPK I tried changing the login function to the new one posted above but it's still doing the same thing for some reason, Where can I download the new Tubenoia source code?? I tried github but it's still the old version
     
  17. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    haha I'm raping this thread, but this is really frustrating. I think I found the problem, on the httpPost the webResponse property - IsMutuallyAuthenticated is false so maybe the the bot isn't properly connecting to SSL and that explains the same happening when trying to login from a local html file.
     
  18. izSpK

    izSpK BANNED BANNED

    Joined:
    Sep 5, 2010
    Messages:
    1,546
    Likes Received:
    1,666
    I just tried the code I posted and it worked just fine. You're probably doing something wrong.
     
  19. ilPatrino

    ilPatrino Junior Member

    Joined:
    Sep 6, 2011
    Messages:
    130
    Likes Received:
    15
    :/ I don't know the reason behind it, I spent the whole morning trying to figure it out to no avail. The thing is that the login actually works but only with some proxies. It won't work with most proxies not even with my own ip(without proxies). So I compared all the headers and cookies this morning between 1 working proxy & 1 non-working & the only difference I noticed is that when going to yt's home page the working proxy gets 1 extra cookie - PERF. This is really driving me crazing as I know everything is ok, I haven't made any changes to the webwrapper either.
     
  20. izSpK

    izSpK BANNED BANNED

    Joined:
    Sep 5, 2010
    Messages:
    1,546
    Likes Received:
    1,666
    I see your problem. It is because your IP is CAPTCHA'd. If you actually type anything on the login manually, you will notice a CAPTCHA. Happened to me once too.