ultra.marine
Registered Member
- Oct 5, 2012
- 80
- 105
Okay, I am trying to log on youtube using http web request but I am getting this feedback from youtube "Your browser's cookie functionality is turned off. Please turn it on"
Any help, hits or anything I will be thankful!
Any help, hits or anything I will be thankful!
Code:
Dim tempCookies As New CookieContainer
Dim postData As String = "continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dsign_in_button%26hl%3Den_US%26next%3D%252F%26nomobiletemp%3D1&service=youtube&dsh=-9120265060045154752&hl=en_US&GALX=xgj0d0m6phE&pstMsg=1&dnConn=&checkConnection=youtube%3A212%3A1&checkedDomains=youtube&timeStmp=&secTok=&_utf8=%E2%98%83&bgresponse=%21A0JW0zonfLaO7kT-7m88MYDfHgIAAABUUgAAAA4qAQsxnzRQHLCiYtetendJsDYVMbUPHMynXE9B_fvNVQJKhD2KyxW9E03fKTVJ1tcKd2KN4ivJz-O7_MzUHmL6v2NVMN-O10Ms5W6SrHvumwMXoNeozmvKHidnGmS1h-Y0ynR_JQl_wUoHydgg6J7OctiL9Zafvok5BSlj-KBRH-BUSLUrtoMuv9tna37N-xwRAQLiAmmOVyfQsF1uov3O-iHlB5bZL8RzszIWeiSJacz7dkCZvR3YbKR7NRF0fReiQtWQx4atJ2KRJ6ogScEYsa6RTqAXboEaqqyEsd1sE0pjmmoAOQXL8OngfKuTyCy7ac-ILQLszuQyspXGvpY_wqiHJIC1lCX_aYnynq0&Email=USERNAME%40MAIL.COM&Passwd=MYPASSWORD1&signIn=Sign+in&PersistentCookie=yes&rmShown=1"
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://accounts.google.com/ServiceLoginAuth"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = New CookieContainer()
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "Https://accounts.google.com/ServiceLogin?uilel=3&service=youtube&continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dsign_in_button%26hl%3Den_US%26next%3D%252F%26nomobiletemp%3D1&passive=true&hl=en_US"
postReq.UserAgent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.872.0 Safari/535.2"
postReq.ContentLength = byteData.Length
Dim postreqstream As Stream = postReq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
loginCookie = tempCookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
RichTextBox1.Text = thepage