Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Strict On
- Imports System.Net, System.IO, System.Text.RegularExpressions
- Module Module1
- Class Youtube
- Private Containa As CookieContainer = New CookieContainer
- Private Function Req(ByVal Site As String, ByVal Met As String, Optional ByVal P As String = "") As String
- Dim Response As String = String.Empty
- Try
- Dim R As HttpWebRequest = CType(HttpWebRequest.Create(Site), HttpWebRequest)
- R.Method = Met
- R.CookieContainer = Containa
- R.AllowAutoRedirect = True
- R.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0"
- R.ContentType = "application/x-www-form-urlencoded"
- R.ServicePoint.Expect100Continue = False
- If Met = "POST" Then
- R.ContentLength = P.Length
- Dim Wr As New StreamWriter(R.GetRequestStream(), System.Text.Encoding.Default)
- Wr.Write(P)
- Wr.Close()
- End If
- Dim Re As New StreamReader(R.GetResponse.GetResponseStream())
- Response = Re.ReadToEnd
- Re.Close()
- Catch
- End Try
- Return Response
- End Function
- Public Function Login(ByVal Nick As String, ByVal Pass As String) As Boolean
- Dim S As String = Req("https://accounts.google.com/ServiceLoginAuth", "GET")
- Dim Galx As String = Regex.Match(S, "GALX""\s+value=""([^""]+)").Groups(1).Value
- Dim Dsh As String = Regex.Match(S, "dsh"" value=""([^""]+)").Groups(1).Value
- Dim Location As String = Regex.Match(S, "&hl=([^""]+)").Groups(1).Value
- Dim Ltmpl As String = Regex.Match(S, "ltmpl=([^&]+)").Groups(1).Value
- Dim Log As String = "continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dheader%26nomobiletemp%3D1%26hl%3D" & Location & "%26next%3D%252F%253Fgl%253DDE%2526hl%253Dde&service=youtube&uilel=3&dsh=" & Dsh & "<mpl=" & Ltmpl & "&hl=de_DE&GALX=" & Galx & "&pstMsg=1&dnConn=&checkConnection=youtube%3A778%3A1&checkedDomains=youtube&timeStmp=&secTok=&Email=" & Nick & "&Passwd=" & Pass & "&signIn=Anmelden&PersistentCookie=yes&rmShown=1"
- Dim Loggin As String = Req("https://accounts.google.com/ServiceLoginAuth", "POST", Log)
- Return Loggin.Contains("Loading, please wait") AndAlso Not Loggin.Contains("Nutzername oder das Passwort ist falsch")
- End Function
- End Class
- Sub Main()
- Console.WriteLine("Please type in your youtube nickname: " & Environment.NewLine)
- Dim Nick As String = Console.ReadLine
- Console.WriteLine("Please type in your pass: " & Environment.NewLine)
- Dim Pw As String = Console.ReadLine
- Console.Clear()
- Console.WriteLine(">> Trying to log in ...")
- Dim B As New Youtube
- If B.Login(Nick, Pw) Then Console.WriteLine(">>> Login successfully!") Else Console.WriteLine(">>> Login failed!")
- Console.ReadLine()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement