tronclass-auto 1.4.3 → 1.4.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/video.js +2 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tronclass-auto",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "自動觀看 eclass/TronClass 影片、填寫表單的 CLI 工具",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/video.js CHANGED
@@ -126,8 +126,8 @@ async function watchYouTube(page, stats) {
126
126
  return 180;
127
127
  });
128
128
 
129
- const waitTime = (rate >= 2 ? Math.ceil(ytDuration / 2) : ytDuration) + 30;
130
- log(chalk.blue(` ~${formatTime(ytDuration)} video → ~${formatTime(waitTime)} (${rate}x)`));
129
+ const waitTime = ytDuration + 30;
130
+ log(chalk.blue(` ~${formatTime(ytDuration)} video → ~${formatTime(waitTime)} (2x playback, full wait)`));
131
131
 
132
132
  if (stats) {
133
133
  stats.currentVideoDuration = ytDuration;
@@ -160,27 +160,6 @@ async function watchYouTube(page, stats) {
160
160
  }
161
161
 
162
162
  log(chalk.green(' Done ✓'));
163
- log(chalk.gray(' Syncing with platform...'));
164
-
165
- for (let i = 0; i < 5; i++) {
166
- await page.evaluate(() => {
167
- const f = document.querySelector('iframe[src*="youtube"], iframe[src*="youtu.be"]');
168
- if (!f) return;
169
- try {
170
- f.contentWindow.postMessage(JSON.stringify({ event: 'command', func: 'seekTo', args: [670, true] }), '*');
171
- f.contentWindow.postMessage(JSON.stringify({ event: 'command', func: 'playVideo', args: [] }), '*');
172
- } catch(e) {}
173
- });
174
- await page.waitForTimeout(3000);
175
- await page.evaluate(() => {
176
- const f = document.querySelector('iframe[src*="youtube"], iframe[src*="youtu.be"]');
177
- if (!f) return;
178
- try {
179
- f.contentWindow.postMessage(JSON.stringify({ event: 'command', func: 'pauseVideo', args: [] }), '*');
180
- } catch(e) {}
181
- });
182
- await page.waitForTimeout(2000);
183
- }
184
163
 
185
164
  if (stats) stats.videosWatched++;
186
165
  return true;