Skip to content

Commit

Permalink
Merge pull request #60 from W864/shorts-fix
Browse files Browse the repository at this point in the history
Fix reading of shorts
  • Loading branch information
gatecrasher777 authored Sep 9, 2024
2 parents 2e298ae + 2034e1e commit 4a6200b
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion lib/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class Channel extends Model {
v = v.contents[0].videoRenderer;
}
if (s) {
s = s.content.reelItemRenderer;
if (s.content.reelItemRenderer) s = s.content.reelItemRenderer;
else s = s.content.shortsLockupViewModel;
if (!s) v = item.richItemRenderer.content.videoRenderer;
}
if (w && w.videoId) {
Expand Down Expand Up @@ -176,6 +177,30 @@ class Channel extends Model {
if (ts > this.latest) this.latest = ts;
found.push(video);
} catch (e) { this.debug(e); }
} else if (s && s.entityId) {
const videoId = s.onTap && s.onTap.innertubeCommand && s.onTap.innertubeCommand.reelWatchEndpoint
&& s.onTap.innertubeCommand.reelWatchEndpoint.videoId;
const title = s.overlayMetadata && s.overlayMetadata.primaryText && s.overlayMetadata.primaryText.content;
const viewsString = s.overlayMetadata && s.overlayMetadata.secondaryText
&& s.overlayMetadata.secondaryText.content;
const views = ut.viewQ(viewsString);
// No durations given for shorts
if (videoId && title && viewsString) {
try {
this.quantity++;
let ts = 0;
const video = new Video(this.session, { id: videoId, published: ts });
video.title = title;
video.views = views;
video.viewsString = viewsString;
video.author = this.author;
video.channelId = this.id;
video.channelThumb = this.thumbnail;
video.country = this.country;
if (ts > this.latest) this.latest = ts;
found.push(video);
} catch (e) { this.debug(e); }
}
} else if (m) {
try {
this.more = m.continuationEndpoint.continuationCommand.token;
Expand Down

0 comments on commit 4a6200b

Please sign in to comment.