aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/components/SubmissionNoticeComponent.tsx2
-rw-r--r--src/content.ts11
2 files changed, 9 insertions, 4 deletions
diff --git a/src/components/SubmissionNoticeComponent.tsx b/src/components/SubmissionNoticeComponent.tsx
index de7d4df9..a380fd73 100644
--- a/src/components/SubmissionNoticeComponent.tsx
+++ b/src/components/SubmissionNoticeComponent.tsx
@@ -161,7 +161,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
}
// 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;
for (const sponsorTime of sponsorTimesSubmitting) {
if (!sponsorTime.category.startsWith("music_")) {
diff --git a/src/content.ts b/src/content.ts
index 6d234a9a..f348da51 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -660,7 +660,7 @@ function sponsorsLookup(id: string) {
//check if this video was uploaded recently
utils.wait(() => !!videoInfo).then(() => {
- let dateUploaded = videoInfo.microformat.playerMicroformatRenderer.uploadDate;
+ let dateUploaded = videoInfo?.microformat?.playerMicroformatRenderer?.uploadDate;
//if less than 3 days old
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
function whitelistCheck() {
- channelID = videoInfo.videoDetails.channelId;
+ channelID = videoInfo?.videoDetails?.channelId;
+ if (!channelID) {
+ channelID = null;
+
+ return;
+ }
//see if this is a whitelisted channel
let whitelistedChannels = Config.config.whitelistedChannels;
@@ -1545,7 +1550,7 @@ function getSegmentsMessage(segments: number[][]): string {
* Assumes that the the privacy info is available.
*/
function isUnlisted(): boolean {
- return videoInfo.microformat.playerMicroformatRenderer.isUnlisted || videoInfo.videoDetails.isPrivate;
+ return videoInfo?.microformat?.playerMicroformatRenderer?.isUnlisted || videoInfo?.videoDetails?.isPrivate;
}
/**