Skip to content

feat(IntentHelper): try to resolve unkown URLs - #8937

Open
FineFindus wants to merge 3 commits into
libre-tube:masterfrom
FineFindus:feat/resolve-unknown-urls
Open

FineFindus wants to merge 3 commits into
libre-tube:masterfrom
FineFindus:feat/resolve-unknown-urls

Conversation

@FineFindus

Copy link
Copy Markdown
Collaborator

Tries to handle unknown URLs by trying to resolve them using the API. That allows to handle vanity channel URLs such as "https://www.youtube.com/youtube" (which is equivalent to "https://www.youtube.com/@youtube" when using a channel handle).

While the API does allows to resolve other URLs too (e.g. a short URL can be resolved to the full video URL), we are currently not taking advantage of that, as we're already handling other URL type reasonably well.

Tries to handle unknown URLs by trying to resolve them using the API. That allows
to handle vanity channel URLs such as "https://www.youtube.com/youtube"
@Bnyro

Bnyro commented Nov 27, 2026

Copy link
Copy Markdown
Member

I feel like it would be better to have this in the NewPipeExtractor, but I don't think it's worth the additional efforts to maintain this change in our NPE fork, so I get why you put it here.

putExtra(IntentData.timeStamp, uri.getQueryParameter("t")?.toTimeInSeconds())
}
else -> {
val channelId = runBlocking { resolveUrl(uri) } ?: return@with null

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.

I've kinda tried to get rid of all runBlocking calls in the past year, I'm not that happy with adding new ones. Ideally we should just make resolveType suspend and update all uses to be async.

In any case, this should be runBlocking(Dispatchers.IO) { ... }.

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.

For database calls it's somewhat okay to use runBlocking if we know they're fast, but for network calls we can't know that.

@FineFindus

Copy link
Copy Markdown
Collaborator Author

I feel like it would be better to have this in the NewPipeExtractor, but I don't think it's worth the additional efforts to maintain this change in our NPE fork, so I get why you put it here.

The extractor does implement that (and I only now realized, that it is public, so we can use it), but we currently have way to load content from an arbitrary URL, so we need to resolve it to one we know how to handle first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants