fix: error search feature
This commit is contained in:
parent
1aefbd3dd1
commit
3d341c7fa1
@ -170,7 +170,7 @@ export const _getCommentsParams = (id: string, count: number) => {
|
|||||||
export const _userSearchParams = (
|
export const _userSearchParams = (
|
||||||
keyword: string,
|
keyword: string,
|
||||||
page: number,
|
page: number,
|
||||||
xbogus?: any
|
xbogus?: string
|
||||||
) => {
|
) => {
|
||||||
let cursor = 0
|
let cursor = 0
|
||||||
if (page > 1) {
|
if (page > 1) {
|
||||||
@ -179,7 +179,7 @@ export const _userSearchParams = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const params = {
|
const params: any = {
|
||||||
WebIdLastTime: Date.now(),
|
WebIdLastTime: Date.now(),
|
||||||
aid: "1988",
|
aid: "1988",
|
||||||
app_language: "en",
|
app_language: "en",
|
||||||
@ -189,26 +189,28 @@ export const _userSearchParams = (
|
|||||||
browser_online: true,
|
browser_online: true,
|
||||||
browser_platform: "Win32",
|
browser_platform: "Win32",
|
||||||
browser_version:
|
browser_version:
|
||||||
"5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0",
|
"5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0",
|
||||||
channel: "tiktok_web",
|
channel: "tiktok_web",
|
||||||
cookie_enabled: true,
|
cookie_enabled: true,
|
||||||
cursor: cursor,
|
cursor: cursor,
|
||||||
device_id: generateDeviceId(),
|
data_collection_enabled: true,
|
||||||
|
device_id: "7487787165935371783",
|
||||||
device_platform: "web_pc",
|
device_platform: "web_pc",
|
||||||
focus_state: false,
|
focus_state: true,
|
||||||
from_page: "search",
|
from_page: "search",
|
||||||
history_len: 5,
|
history_len: 4,
|
||||||
is_fullscreen: false,
|
is_fullscreen: false,
|
||||||
is_page_visible: true,
|
is_page_visible: true,
|
||||||
keyword: keyword,
|
keyword: keyword,
|
||||||
|
odinId: generateOdinId(),
|
||||||
os: "windows",
|
os: "windows",
|
||||||
priority_region: "ID",
|
priority_region: "ID",
|
||||||
referer: "",
|
referer: "",
|
||||||
region: "ID",
|
region: "ID",
|
||||||
screen_height: 768,
|
screen_height: 1080,
|
||||||
screen_width: 1366,
|
screen_width: 1920,
|
||||||
search_id: generateSearchId(),
|
|
||||||
tz_name: "Asia/Jakarta",
|
tz_name: "Asia/Jakarta",
|
||||||
|
user_is_login: true,
|
||||||
web_search_code: {
|
web_search_code: {
|
||||||
tiktok: {
|
tiktok: {
|
||||||
client_params_x: {
|
client_params_x: {
|
||||||
@ -251,7 +253,7 @@ export const _liveSearchParams = (keyword: string, page: number) => {
|
|||||||
channel: "tiktok_web",
|
channel: "tiktok_web",
|
||||||
cookie_enabled: "true",
|
cookie_enabled: "true",
|
||||||
count: "20",
|
count: "20",
|
||||||
device_id: generateDeviceId(),
|
device_id: "7487787165935371783",
|
||||||
device_platform: "web_pc",
|
device_platform: "web_pc",
|
||||||
device_type: "web_h264",
|
device_type: "web_h264",
|
||||||
focus_state: "true",
|
focus_state: "true",
|
||||||
@ -298,7 +300,7 @@ export const _videoSearchParams = (keyword: string, page: number) => {
|
|||||||
channel: "tiktok_web",
|
channel: "tiktok_web",
|
||||||
cookie_enabled: "true",
|
cookie_enabled: "true",
|
||||||
count: "20",
|
count: "20",
|
||||||
device_id: generateDeviceId(),
|
device_id: "7487787165935371783",
|
||||||
device_platform: "web_pc",
|
device_platform: "web_pc",
|
||||||
device_type: "web_h264",
|
device_type: "web_h264",
|
||||||
focus_state: "true",
|
focus_state: "true",
|
||||||
|
|||||||
@ -83,7 +83,6 @@ export class TiktokService {
|
|||||||
const baseUrl = `${TiktokService.BASE_URL}api/search/user/full/?`
|
const baseUrl = `${TiktokService.BASE_URL}api/search/user/full/?`
|
||||||
const queryParams = _userSearchParams(username, page)
|
const queryParams = _userSearchParams(username, page)
|
||||||
const xbogusParams = xbogus(`${baseUrl}${queryParams}`, userAgent)
|
const xbogusParams = xbogus(`${baseUrl}${queryParams}`, userAgent)
|
||||||
console.log(`${baseUrl}${_userSearchParams(username, page, xbogusParams)}`)
|
|
||||||
|
|
||||||
return `${baseUrl}${_userSearchParams(username, page, xbogusParams)}`
|
return `${baseUrl}${_userSearchParams(username, page, xbogusParams)}`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { _userSearchParams } from "../../constants/params"
|
|||||||
import { HttpsProxyAgent } from "https-proxy-agent"
|
import { HttpsProxyAgent } from "https-proxy-agent"
|
||||||
import { SocksProxyAgent } from "socks-proxy-agent"
|
import { SocksProxyAgent } from "socks-proxy-agent"
|
||||||
import { TiktokService } from "../../services/tiktokService"
|
import { TiktokService } from "../../services/tiktokService"
|
||||||
import { userAgent } from "../../constants/headers"
|
import { userAgent, webUserAgent } from "../../constants/headers"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tiktok Search User
|
* Tiktok Search User
|
||||||
@ -38,7 +38,7 @@ export const SearchUser = (
|
|||||||
Axios(Tiktok.generateURLXbogus(username, page), {
|
Axios(Tiktok.generateURLXbogus(username, page), {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": userAgent,
|
"User-Agent": webUserAgent,
|
||||||
cookie:
|
cookie:
|
||||||
typeof cookie === "object"
|
typeof cookie === "object"
|
||||||
? cookie.map((v: any) => `${v.name}=${v.value}`).join("; ")
|
? cookie.map((v: any) => `${v.name}=${v.value}`).join("; ")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user