change UA to chrome 151
This commit is contained in:
1 parent
76e2d8b1cf
commit
0cb812677a
6 files changed
+37
-5
No files matched your search
@@ -80,7 +80,7 @@ object VP8Defaults {
|
|||||||
|
|
||||||
const val BLANK_URL = "about:blank"
|
const val BLANK_URL = "about:blank"
|
||||||
|
|
||||||
const val DESKTOP_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
const val DESKTOP_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36"
|
||||||
|
|
||||||
object Vpn {
|
object Vpn {
|
||||||
const val ADDRESS = "10.0.0.2"
|
const val ADDRESS = "10.0.0.2"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export const WINDOW_HEIGHT = 800;
|
|||||||
|
|
||||||
export const USER_AGENT =
|
export const USER_AGENT =
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' +
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' +
|
||||||
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36';
|
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36';
|
||||||
|
|
||||||
export const VK_COOKIE_DOMAINS = ['vk.ru'];
|
export const VK_COOKIE_DOMAINS = ['vk.ru'];
|
||||||
export const YANDEX_COOKIE_DOMAINS = ['yandex.ru', 'yandex.net', 'ya.ru'];
|
export const YANDEX_COOKIE_DOMAINS = ['yandex.ru', 'yandex.net', 'ya.ru'];
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ struct CaptchaWebView: UIViewRepresentable {
|
|||||||
|
|
||||||
func makeUIView(context: Context) -> WKWebView {
|
func makeUIView(context: Context) -> WKWebView {
|
||||||
let webView = WKWebView()
|
let webView = WKWebView()
|
||||||
webView.customUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
webView.customUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36"
|
||||||
webView.load(URLRequest(url: url))
|
webView.load(URLRequest(url: url))
|
||||||
return webView
|
return webView
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ struct CaptchaWebView: UIViewRepresentable {
|
|||||||
|
|
||||||
func makeUIView(context: Context) -> WKWebView {
|
func makeUIView(context: Context) -> WKWebView {
|
||||||
let webView = WKWebView()
|
let webView = WKWebView()
|
||||||
webView.customUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
webView.customUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36"
|
||||||
webView.load(URLRequest(url: url))
|
webView.load(URLRequest(url: url))
|
||||||
return webView
|
return webView
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ package common
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand/v2"
|
"math/rand/v2"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/kulikov0/headless-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeviceProfile struct {
|
type DeviceProfile struct {
|
||||||
@@ -35,6 +38,8 @@ type browserTemplate struct {
|
|||||||
userAgentFn func(osVersion, browserVersion string) string
|
userAgentFn func(osVersion, browserVersion string) string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var windowsDeviceBrands = []string{"Dell", "Lenovo", "HP", "Asus", "Acer", "MSI"}
|
||||||
|
|
||||||
var commonScreens = [][2]int{
|
var commonScreens = [][2]int{
|
||||||
{1280, 720}, {1366, 768}, {1440, 900}, {1536, 864},
|
{1280, 720}, {1366, 768}, {1440, 900}, {1536, 864},
|
||||||
{1600, 900}, {1680, 1050}, {1728, 1117}, {1920, 1080},
|
{1600, 900}, {1680, 1050}, {1728, 1117}, {1920, 1080},
|
||||||
@@ -170,3 +175,30 @@ func RandomDeviceProfile() DeviceProfile {
|
|||||||
ScreenHeight: screen[1],
|
ScreenHeight: screen[1],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func chromeVersionFromUserAgent(userAgent string) string {
|
||||||
|
_, rest, found := strings.Cut(userAgent, "Chrome/")
|
||||||
|
if !found {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
version, _, _ := strings.Cut(rest, " ")
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
|
func ChromeWindowsDeviceProfile() DeviceProfile {
|
||||||
|
userAgent := headless.ChromeWindows.UserAgent()
|
||||||
|
screen := commonScreens[rand.IntN(len(commonScreens))]
|
||||||
|
return DeviceProfile{
|
||||||
|
UserAgent: userAgent,
|
||||||
|
Platform: "web",
|
||||||
|
BrowserType: "Chrome",
|
||||||
|
BrowserVersion: chromeVersionFromUserAgent(userAgent),
|
||||||
|
DeviceBrand: windowsDeviceBrands[rand.IntN(len(windowsDeviceBrands))],
|
||||||
|
DeviceModel: "PC",
|
||||||
|
DeviceType: "pc",
|
||||||
|
OS: "Windows",
|
||||||
|
OSVersion: "10",
|
||||||
|
ScreenWidth: screen[0],
|
||||||
|
ScreenHeight: screen[1],
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -182,7 +182,7 @@ func NewSession(httpClient *http.Client) (*Session, error) {
|
|||||||
}
|
}
|
||||||
httpClient.Jar = jar
|
httpClient.Jar = jar
|
||||||
}
|
}
|
||||||
return &Session{HTTPClient: httpClient, Device: common.RandomDeviceProfile()}, nil
|
return &Session{HTTPClient: httpClient, Device: common.ChromeWindowsDeviceProfile()}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) RegisterGuest() (*GuestAuthResponse, error) {
|
func (s *Session) RegisterGuest() (*GuestAuthResponse, error) {
|
||||||
|
|||||||
Reference in new issue
Block a user