Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,38 @@ public String getUploaderName() throws ParsingException {

@Override
public String getUploaderUrl() throws ParsingException {
final String channelId = channelImageViewModel()
final JsonObject innerTubeCommand = channelImageViewModel()
.forUploaderUrlExtraction()
.getObject("rendererContext")
.getObject("commandContext")
.getObject("onTap")
.getObject("innertubeCommand")
.getObject("browseEndpoint")
.getObject("innertubeCommand");
final JsonObject browseEndpoint = innerTubeCommand
.getObject("browseEndpoint");
final String channelId = browseEndpoint
.getString("browseId");

if (isNullOrEmpty(channelId)) {
throw new ParsingException("Could not get uploader url");
if (channelId != null && channelId.startsWith("UC")) {
return YoutubeChannelLinkHandlerFactory.getInstance().getUrl("channel/" + channelId);
}
return YoutubeChannelLinkHandlerFactory.getInstance().getUrl(channelId);

final String canonicalBaseUrl = browseEndpoint.getString("canonicalBaseUrl");
if (!isNullOrEmpty(canonicalBaseUrl)) {
return resolveUploaderUrlFromRelativeUrl(canonicalBaseUrl);
}

final String webCommandMetadataUrl = innerTubeCommand.getObject("commandMetadata")
.getObject("webCommandMetadata")
.getString("url");
if (!isNullOrEmpty(webCommandMetadataUrl)) {
return resolveUploaderUrlFromRelativeUrl(webCommandMetadataUrl);
}

throw new ParsingException("Could not get uploader url");
}

private String resolveUploaderUrlFromRelativeUrl(final String url) throws ParsingException {
return YoutubeChannelLinkHandlerFactory.getInstance().getUrl("c" + url);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding c results in https://www.youtube.com/c/@handle which is invalid! Also url should be renamed to something else, as it is not an entire URL.

Suggested change
return YoutubeChannelLinkHandlerFactory.getInstance().getUrl("c" + url);
return YoutubeChannelLinkHandlerFactory.getInstance().getUrl(url);

Copy link
Copy Markdown
Member

@litetex litetex Jul 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.youtube.com/c/@handle which is invalid!

Well then YouTubeChannelExtractor is broken because it can't resolve https://www.youtube.com/@handle but successfully resolves https://www.youtube.com/c/@handle.

Update: Looks like there was something wrong on my end because https://www.youtube.com/@handle now also works...

Update v2: Ok now I'm really confused it sometimes works in the app and sometimes not. I'm not quite sure what's going on...

I will provide a fix for that in a new PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AudricV

There was a general problem with channelId resolution.

I created #1347

}

@Nonnull
Expand Down