新增获取账号地址方法
This commit is contained in:
@@ -110,7 +110,7 @@ func (*TwitterService) Login(id int) *libs.ErrorInfo {
|
||||
fmt.Println(err)
|
||||
}
|
||||
// getAccountInfo(page, int64(id))
|
||||
// getRegisterInfo(page, int64(id), user.Password)
|
||||
// getRegisterInfo(page, int64(id), user.Password, user.Name)
|
||||
return libs.ErrorCode["LoginSuccessful"]
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ func getAccountInfo(page *rod.Page, id int64) {
|
||||
})
|
||||
}
|
||||
|
||||
func getRegisterInfo(page *rod.Page, id int64, password string) {
|
||||
func getRegisterInfo(page *rod.Page, id int64, password, name string) {
|
||||
// 进入账号信息页面
|
||||
page.MustNavigate("https://x.com/settings/your_twitter_data/account").MustWaitLoad()
|
||||
page.MustWaitNavigation()
|
||||
@@ -251,11 +251,19 @@ func getRegisterInfo(page *rod.Page, id int64, password string) {
|
||||
log.Println("注册IP:", ip)
|
||||
log.Println("注册地区:", region)
|
||||
log.Println("创建时间:", createdAt)
|
||||
// 获取当前账号的账号地址
|
||||
var location string
|
||||
page.MustNavigate("https://x.com/" + name + "/about").MustWaitLoad()
|
||||
locationElement, err := page.Timeout(10 * time.Second).Element(`#react-root > div > div > div.css-175oi2r.r-1f2l425.r-13qz1uu.r-417010.r-18u37iz > main > div > div > div > div.css-175oi2r.r-14lw9ot.r-jxzhtn.r-1ua6aaf.r-th6na.r-1phboty.r-16y2uox.r-184en5c.r-1abdc3e.r-1lg4w6u.r-f8sm7e.r-13qz1uu.r-1ye8kvj > div > div.css-175oi2r.r-16pcm1t > div.css-175oi2r.r-1wtj0ep.r-16x9es5.r-1mmae3n.r-1loqt21.r-o7ynqc.r-6416eg.r-1ny4l3l > div > div.css-175oi2r.r-16y2uox.r-1wbh5a2 > div:nth-child(2)`)
|
||||
if err == nil {
|
||||
location = locationElement.MustText()
|
||||
}
|
||||
userService := InitTwitterAccountService()
|
||||
userService.Update(id, &models.TwitterAccount{
|
||||
RegisterIp: ip,
|
||||
RegisterDate: createdAt,
|
||||
RegisterAddress: region,
|
||||
Address: location,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user