tronclass-auto 1.5.6 → 1.6.0
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/index.js +11 -10
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -110,7 +110,7 @@ async function processCourse(page, courseId, stats) {
|
|
|
110
110
|
try {
|
|
111
111
|
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 15000 });
|
|
112
112
|
} catch (e) {}
|
|
113
|
-
await page.waitForTimeout(
|
|
113
|
+
await page.waitForTimeout(15000);
|
|
114
114
|
|
|
115
115
|
if (!page.url().includes('learning-activity')) {
|
|
116
116
|
console.log(chalk.yellow(' Page redirect, skipping'));
|
|
@@ -155,13 +155,15 @@ async function processCourse(page, courseId, stats) {
|
|
|
155
155
|
}
|
|
156
156
|
const success = await watchVideo(page, stats);
|
|
157
157
|
if (success) {
|
|
158
|
+
console.log(chalk.gray(' Waiting for platform tracking...'));
|
|
159
|
+
await page.waitForTimeout(30000);
|
|
160
|
+
|
|
158
161
|
let serverComplete = false;
|
|
159
|
-
|
|
160
|
-
await page.waitForTimeout(10000);
|
|
162
|
+
try {
|
|
161
163
|
await page.goto(`${BASE_URL}/course/${courseId}/content#/`, {
|
|
162
|
-
waitUntil: 'domcontentloaded', timeout:
|
|
163
|
-
})
|
|
164
|
-
await page.waitForTimeout(
|
|
164
|
+
waitUntil: 'domcontentloaded', timeout: 20000
|
|
165
|
+
});
|
|
166
|
+
await page.waitForTimeout(8000);
|
|
165
167
|
|
|
166
168
|
serverComplete = await page.evaluate((actId) => {
|
|
167
169
|
const el = document.querySelector('.learning-activities');
|
|
@@ -178,9 +180,8 @@ async function processCourse(page, courseId, stats) {
|
|
|
178
180
|
}
|
|
179
181
|
return false;
|
|
180
182
|
}, act.id);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
console.log(chalk.gray(` Checking server... (${attempt + 1}/5)`));
|
|
183
|
+
} catch (e) {
|
|
184
|
+
console.log(chalk.gray(` Server check error: ${e.message.substring(0, 40)}`));
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
if (serverComplete) {
|
|
@@ -188,7 +189,7 @@ async function processCourse(page, courseId, stats) {
|
|
|
188
189
|
done++;
|
|
189
190
|
console.log(chalk.green(' ✓ Saved (server confirmed)'));
|
|
190
191
|
} else {
|
|
191
|
-
console.log(chalk.yellow(' Server not confirmed
|
|
192
|
+
console.log(chalk.yellow(' Server not confirmed, skipping'));
|
|
192
193
|
triedIds.add(act.id);
|
|
193
194
|
fail++;
|
|
194
195
|
}
|