Skip to content

Commit

Permalink
Fix: Not verifying mails
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard127 committed Jul 21, 2023
1 parent f7cc5ac commit e089650
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ func main() {

client = api2captcha.NewClient(os.Getenv("API_KEY"))

for {
fmt.Println("Starting...")
browser := rod.New().MustConnect()
fmt.Println("Starting...")
browser := rod.New().MustConnect()

browser.SlowMotion(time.Millisecond * 10)
browser.SlowMotion(time.Millisecond * 10)

for {
page := browser.MustPage("https://old.reddit.com/login")

fmt.Println("Page opened")

user := NewRandomUser()

page.MustElement("#user_reg").MustInput(user.Username)
Expand Down Expand Up @@ -80,19 +79,20 @@ func main() {
})
fmt.Println("Email received")
i := strings.Index(verification.Body, `https://www.reddit.com/verification/`)
link := verification.HtmlBody[i : i+strings.Index(verification.HtmlBody[i:], `"`)]
fmt.Println(link)

browser.MustPage(link)
page.WaitLoad()
page.MustNavigate(verification.HtmlBody[i : i+strings.Index(verification.HtmlBody[i:], `"`)])
page.MustWaitStable()

bytes, _ = page.Screenshot(true, nil)
os.WriteFile(fmt.Sprintf("screenshot%d.png", index), bytes, 0644)

fmt.Println("Verifying email...")
page.MustElement("#verify-email > button").MustClick()
if page.MustHas("#verify-email > button") {
page.MustElement("#verify-email > button").MustClick()
}
fmt.Println("Email verified")

browser.MustClose()
fmt.Println("Waiting 10 minutes...")

time.Sleep(time.Minute * 10)
}
}
Expand Down

0 comments on commit e089650

Please sign in to comment.