Fadi946
Power Member
- Mar 25, 2009
- 621
- 93
Hi guys! So I've been making a YouTube bot this week, and I came across this problem:
Everything works just fine, but there is a problem with the Catpcha... I need to get 2 correct Captcha right to let it work.
For example:
I get "XYZ", I put it correctly, but it doesn't continue.. it gives me another picture "YXZ", I put it correctly and it continues.
I do not know why this is happening to me! Can anyone tell me what's going on?
PS: Manually it works fine on the first attempt.
I will post the code for the captcha form, Here:
Edit 1: When I try to do it manually using Internet Explorer, I noticed that everytime I finish a captcha and submit, a window pops up saying "Set or Add google as your homepage" with "Yes" and "No" options, after clicking "Yes" (So I can get rid of it) it refreshes the page and I need to put the info again, and after doing it on the second time, it doesn't ask me anything and it works fine (continues to the next page).
I thought this was the problem, but I fixed it that it will not pop up the window... didn't help, I still need to do the Captcha twice =\
EDIT 2 : STILL DOESNT WORK! Please help =S Here is the code again:
Everything works just fine, but there is a problem with the Catpcha... I need to get 2 correct Captcha right to let it work.
For example:
I get "XYZ", I put it correctly, but it doesn't continue.. it gives me another picture "YXZ", I put it correctly and it continues.
I do not know why this is happening to me! Can anyone tell me what's going on?
PS: Manually it works fine on the first attempt.
I will post the code for the captcha form, Here:
Edit 1: When I try to do it manually using Internet Explorer, I noticed that everytime I finish a captcha and submit, a window pops up saying "Set or Add google as your homepage" with "Yes" and "No" options, after clicking "Yes" (So I can get rid of it) it refreshes the page and I need to put the info again, and after doing it on the second time, it doesn't ask me anything and it works fine (continues to the next page).
I thought this was the problem, but I fixed it that it will not pop up the window... didn't help, I still need to do the Captcha twice =\
EDIT 2 : STILL DOESNT WORK! Please help =S Here is the code again:
Code:
Imports System.Runtime.InteropServices
Imports System.Net
Imports mshtml
Imports System.IO
Imports System.Web
Public Class Form2
Dim timer1ticker As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Enabled = True
Timer1.Enabled = True
timer1ticker = 10
Form1.Label13.Text = timer1ticker
TextBox1.Clear()
Dim doc As IHTMLDocument2 = Form1.WebBrowser1.Document.DomDocument
Dim imgRange As IHTMLControlRange = CType(doc.body, HTMLBody).createControlRange
For Each img As IHTMLImgElement In doc.images
If img.GetAttribute("src").ToString.Contains("https://accounts.google.com/Captcha?ctoken=") Then
imgRange.add(img)
imgRange.execCommand("Copy", False, Nothing)
PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)
Exit For
End If
Next
If Form1.WebBrowser1.DocumentText.Contains("Phone") Then
Timer1.Enabled = False
Form1.Timer1.Enabled = False
Form1.Timer2.Enabled = False
Form1.Timer3.Enabled = False
Exit Sub
End If
End Sub
'------------------- 'Captcha Window' ---------------'
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Form1.Label13.Text = timer1ticker
Form1.WebBrowser1.Document.GetElementById("newaccountcaptcha").SetAttribute("value", TextBox1.Text)
Form1.WebBrowser1.Document.GetElementById("submitbutton").InvokeMember("click")
Do While Form1.WebBrowser1.ReadyState <> WebBrowserReadyState.Complete Or Form1.WebBrowser1.IsBusy
Threading.Thread.Sleep(100)
My.Application.DoEvents()
Loop
timer1ticker = 10
Timer1.Enabled = True
If Form1.WebBrowser1.DocumentText.Contains("Phone") Then
Timer1.Enabled = False
Form1.Timer1.Enabled = False
Form1.Timer2.Enabled = False
Form1.Timer3.Enabled = False
Exit Sub
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
timer1ticker = timer1ticker - 1
Form1.Label13.Text = timer1ticker
If timer1ticker = 8 Then
Do While Form1.WebBrowser1.ReadyState <> WebBrowserReadyState.Complete Or Form1.WebBrowser1.IsBusy
Threading.Thread.Sleep(100)
My.Application.DoEvents()
Loop
If Form1.WebBrowser1.Url.ToString().Contains("nts.google.com/NewAccount") Or Form1.WebBrowser1.Url.ToString().Contains("nts.google.com/CreateAccount") Then
Button1.Enabled = True
TextBox1.Clear()
Dim doc As IHTMLDocument2 = Form1.WebBrowser1.Document.DomDocument
Dim imgRange As IHTMLControlRange = CType(doc.body, HTMLBody).createControlRange
For Each img As IHTMLImgElement In doc.images
If img.GetAttribute("src").ToString.Contains("https://accounts.google.com/Captcha?ctoken=") Then
imgRange.add(img)
imgRange.execCommand("Copy", False, Nothing)
PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)
Exit For
End If
Next
If Form1.WebBrowser1.DocumentText.Contains("Re-enter password") Then
Form1.WebBrowser1.Document.GetElementById("Email").InnerText = Form1.currentemail
Form1.WebBrowser1.Document.GetElementById("Passwd").InnerText = Form1.TextBox6.Text
Form1.WebBrowser1.Document.GetElementById("PasswdAgain").InnerText = Form1.TextBox6.Text
Form1.WebBrowser1.Document.GetElementById("Birthday").InnerText = "08/04/1990"
Timer1.Enabled = False
End If
Else
Timer1.Enabled = False
Form1.timer2ticker = 10
Form1.Timer2.Enabled = True
Me.Hide()
Timer1.Enabled = False
End If
End If
If Form1.WebBrowser1.DocumentText.Contains("Phone") Then
Timer1.Enabled = False
Form1.Timer1.Enabled = False
Form1.Timer2.Enabled = False
Form1.Timer3.Enabled = False
Exit Sub
End If
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If (e.KeyCode = Keys.Enter) Then
Button1.PerformClick()
End If
End Sub
End Class
Last edited: