mirror of
https://github.com/verssache/chatgpt-creator.git
synced 2026-05-16 21:59:33 +00:00
feat: Add dynamic domain blacklisting for unsupported_email errors
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/brianvoe/gofakeit/v7"
|
||||
@@ -18,6 +19,13 @@ import (
|
||||
"github.com/verssache/chatgpt-creator/internal/util"
|
||||
)
|
||||
|
||||
var blacklistedDomains sync.Map
|
||||
|
||||
// AddBlacklistDomain adds a domain to the global blacklist.
|
||||
func AddBlacklistDomain(domain string) {
|
||||
blacklistedDomains.Store(domain, true)
|
||||
}
|
||||
|
||||
// CreateTempEmail fetches a new temp email using a random profile and gofakeit names.
|
||||
func CreateTempEmail(defaultDomain string) (string, error) {
|
||||
// If defaultDomain is set, skip fetching from generator.email
|
||||
@@ -61,10 +69,16 @@ func CreateTempEmail(defaultDomain string) (string, error) {
|
||||
doc.Find(".e7m.tt-suggestions div > p").Each(func(i int, s *goquery.Selection) {
|
||||
domain := strings.TrimSpace(s.Text())
|
||||
if domain != "" {
|
||||
domains = append(domains, domain)
|
||||
if _, blacklisted := blacklistedDomains.Load(domain); !blacklisted {
|
||||
domains = append(domains, domain)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if len(domains) == 0 {
|
||||
return "", fmt.Errorf("all available domains are blacklisted")
|
||||
}
|
||||
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
randomDomain := domains[r.Intn(len(domains))]
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
"strings"
|
||||
|
||||
"github.com/verssache/chatgpt-creator/internal/email"
|
||||
"github.com/verssache/chatgpt-creator/internal/util"
|
||||
@@ -97,6 +98,18 @@ func RunBatch(totalAccounts int, outputFile string, maxWorkers int, proxy, defau
|
||||
// Failed — return the slot so it gets retried
|
||||
atomic.AddInt64(&remaining, 1)
|
||||
ts := time.Now().Format("15:04:05")
|
||||
|
||||
if strings.Contains(errStr, "unsupported_email") {
|
||||
parts := strings.Split(emailAddr, "@")
|
||||
if len(parts) == 2 {
|
||||
domain := parts[1]
|
||||
email.AddBlacklistDomain(domain)
|
||||
printMu.Lock()
|
||||
fmt.Printf("[%s] [W%d] ⚠ Blacklisted domain: %s\n", ts, workerID, domain)
|
||||
printMu.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
printMu.Lock()
|
||||
fmt.Printf("[%s] [W%d] ✗ FAILURE: %s | %s\n", ts, workerID, emailAddr, errStr)
|
||||
printMu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user