Skip to content

Commit faa248b

Browse files
committed
add youtube behavior
1 parent 57b7aa4 commit faa248b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/site/youtube.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { AutoScroll } from "../autoscroll";
2+
3+
export class YoutubeBehavior extends AutoScroll {
4+
override async awaitPageLoad(ctx: any) {
5+
const { sleep, assertContentValid } = ctx.Lib;
6+
await sleep(10);
7+
assertContentValid(() => {
8+
const video = document.querySelector("video");
9+
const paused = video && video.paused;
10+
if (paused) {
11+
return false;
12+
}
13+
return document.documentElement.outerHTML.indexOf("not a bot") === -1;
14+
}, "no_video_playing");
15+
}
16+
}

0 commit comments

Comments
 (0)