mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 12:37:05 +03:00
Added null coalescence checks to video info
This commit is contained in:
@@ -161,7 +161,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if any non music categories are being used on a music video
|
// Check if any non music categories are being used on a music video
|
||||||
if (this.contentContainer().videoInfo.microformat.playerMicroformatRenderer.category === "Music") {
|
if (this.contentContainer().videoInfo?.microformat?.playerMicroformatRenderer?.category === "Music") {
|
||||||
let sponsorTimesSubmitting = this.props.contentContainer().sponsorTimesSubmitting;
|
let sponsorTimesSubmitting = this.props.contentContainer().sponsorTimesSubmitting;
|
||||||
for (const sponsorTime of sponsorTimesSubmitting) {
|
for (const sponsorTime of sponsorTimesSubmitting) {
|
||||||
if (!sponsorTime.category.startsWith("music_")) {
|
if (!sponsorTime.category.startsWith("music_")) {
|
||||||
|
|||||||
@@ -660,7 +660,7 @@ function sponsorsLookup(id: string) {
|
|||||||
|
|
||||||
//check if this video was uploaded recently
|
//check if this video was uploaded recently
|
||||||
utils.wait(() => !!videoInfo).then(() => {
|
utils.wait(() => !!videoInfo).then(() => {
|
||||||
let dateUploaded = videoInfo.microformat.playerMicroformatRenderer.uploadDate;
|
let dateUploaded = videoInfo?.microformat?.playerMicroformatRenderer?.uploadDate;
|
||||||
|
|
||||||
//if less than 3 days old
|
//if less than 3 days old
|
||||||
if (Date.now() - new Date(dateUploaded).getTime() < 259200000) {
|
if (Date.now() - new Date(dateUploaded).getTime() < 259200000) {
|
||||||
@@ -812,7 +812,12 @@ function updatePreviewBar() {
|
|||||||
|
|
||||||
//checks if this channel is whitelisted, should be done only after the channelID has been loaded
|
//checks if this channel is whitelisted, should be done only after the channelID has been loaded
|
||||||
function whitelistCheck() {
|
function whitelistCheck() {
|
||||||
channelID = videoInfo.videoDetails.channelId;
|
channelID = videoInfo?.videoDetails?.channelId;
|
||||||
|
if (!channelID) {
|
||||||
|
channelID = null;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//see if this is a whitelisted channel
|
//see if this is a whitelisted channel
|
||||||
let whitelistedChannels = Config.config.whitelistedChannels;
|
let whitelistedChannels = Config.config.whitelistedChannels;
|
||||||
@@ -1545,7 +1550,7 @@ function getSegmentsMessage(segments: number[][]): string {
|
|||||||
* Assumes that the the privacy info is available.
|
* Assumes that the the privacy info is available.
|
||||||
*/
|
*/
|
||||||
function isUnlisted(): boolean {
|
function isUnlisted(): boolean {
|
||||||
return videoInfo.microformat.playerMicroformatRenderer.isUnlisted || videoInfo.videoDetails.isPrivate;
|
return videoInfo?.microformat?.playerMicroformatRenderer?.isUnlisted || videoInfo?.videoDetails?.isPrivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user