tt-help-cli-ycl 1.3.15 → 1.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/tiktok-scraper.mjs +12 -7
package/package.json
CHANGED
|
@@ -99,11 +99,16 @@ export class TikTokScraper {
|
|
|
99
99
|
async warmWaf() {
|
|
100
100
|
if (this.warmPromise) return this.warmPromise;
|
|
101
101
|
this.warmPromise = (async () => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
try {
|
|
103
|
+
const page = this.slots[0].page;
|
|
104
|
+
await page.goto(this.warmUrl, { waitUntil: 'domcontentloaded', timeout: 15000 });
|
|
105
|
+
await delay(1500);
|
|
106
|
+
this.lastWarmTime = Date.now();
|
|
107
|
+
} catch (e) {
|
|
108
|
+
console.error(`[warmWaf] failed: ${e.message}`);
|
|
109
|
+
} finally {
|
|
110
|
+
this.warmPromise = null;
|
|
111
|
+
}
|
|
107
112
|
})();
|
|
108
113
|
return this.warmPromise;
|
|
109
114
|
}
|
|
@@ -154,7 +159,7 @@ export class TikTokScraper {
|
|
|
154
159
|
);
|
|
155
160
|
let result = parseUserInfo(rawHtml);
|
|
156
161
|
if (!result) {
|
|
157
|
-
await this.warmWaf();
|
|
162
|
+
try { await this.warmWaf(); } catch {}
|
|
158
163
|
rawHtml = await this._fetchViewSource(
|
|
159
164
|
`https://www.tiktok.com/@${uniqueId}`,
|
|
160
165
|
slot
|
|
@@ -171,7 +176,7 @@ export class TikTokScraper {
|
|
|
171
176
|
let rawHtml = await this._fetchViewSource(videoUrl, slot);
|
|
172
177
|
let result = parseVideoInfo(rawHtml);
|
|
173
178
|
if (!result) {
|
|
174
|
-
await this.warmWaf();
|
|
179
|
+
try { await this.warmWaf(); } catch {}
|
|
175
180
|
rawHtml = await this._fetchViewSource(videoUrl, slot);
|
|
176
181
|
result = parseVideoInfo(rawHtml);
|
|
177
182
|
}
|