mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-14 08:40:57 +03:00
Fixed issue where some some videos would send many requests to SponsorBlock when only one was needed
This commit is contained in:
@@ -17,10 +17,16 @@ export class SkipAdButtonComponent implements OnInit {
|
||||
sponsor_block_cache = {};
|
||||
show_skip_ad_button = false;
|
||||
|
||||
skip_ad_button_check_interval = null;
|
||||
|
||||
constructor(private postsService: PostsService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
setInterval(() => this.skipAdButtonCheck(), 500);
|
||||
this.skip_ad_button_check_interval = setInterval(() => this.skipAdButtonCheck(), 500);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearInterval(this.skip_ad_button_check_interval);
|
||||
}
|
||||
|
||||
checkSponsorBlock(video_to_check) {
|
||||
@@ -45,6 +51,8 @@ export class SkipAdButtonComponent implements OnInit {
|
||||
const found_data = res['find'](data => data['videoID'] === video_id);
|
||||
if (found_data) {
|
||||
this.sponsor_block_cache[video_to_check.url] = found_data;
|
||||
} else {
|
||||
this.sponsor_block_cache[video_to_check.url] = null;
|
||||
}
|
||||
}, err => {
|
||||
// likely doesn't exist
|
||||
|
||||
Reference in New Issue
Block a user