udate
This commit is contained in:
@@ -197,7 +197,13 @@ export class XBrowserService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
const textarea = page.locator('div[data-testid="tweetTextarea_0"]');
|
||||
await page.waitForTimeout(2000 + (Math.random() + Math.random()) * 3000);
|
||||
await textarea.fill(text);
|
||||
// nhập content (fallback nếu type fail)
|
||||
try {
|
||||
await textarea.fill(''); // clear
|
||||
await textarea.type(text, {delay: 50 + Math.random() * 200});
|
||||
} catch {
|
||||
await textarea.fill(text);
|
||||
}
|
||||
console.log(' Nhập tweet xong ...');
|
||||
await page.waitForTimeout(2000 + (Math.random() + Math.random()) * 3000);
|
||||
await page.waitForTimeout(5000);
|
||||
|
||||
@@ -21,7 +21,7 @@ export enum XStrategy {
|
||||
BROWSER_ONLY = 'browser_only',
|
||||
AUTO = 'auto', // dựa vào health account
|
||||
BROWSER_API = 'browser_api',
|
||||
BROWSER_COOKIE = 'browser_cookie'// khi cần chống bot nặng
|
||||
BROWSER_COOKIE = 'browser_cookie'
|
||||
}
|
||||
|
||||
export interface UnifiedAccount {
|
||||
@@ -196,7 +196,10 @@ export class XPosterRouterService {
|
||||
tweetUrl: params.tweetUrl,
|
||||
tweetId: params.tweetId,
|
||||
});
|
||||
attempts.push({method, error: result.error});
|
||||
attempts.push({
|
||||
method,
|
||||
error: method + ':' + result.error
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
return {
|
||||
@@ -260,7 +263,7 @@ export class XPosterRouterService {
|
||||
text: string,
|
||||
): Promise<{ success: boolean; tweetId?: string; error?: string }> {
|
||||
try {
|
||||
if (method === 'api' && account.api) {
|
||||
if (method === 'api' && account.api && account.api?.appKey) {
|
||||
const {data: r} = await this.apiSvc.postSimpleTweet(text);
|
||||
return {
|
||||
tweetId: r.id,
|
||||
|
||||
Reference in New Issue
Block a user