Repository navigation
feat(IntentHelper): try to resolve unkown URLs - #8937
FineFindus wants to merge 3 commits into
Conversation
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"
|
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 |
There was a problem hiding this comment.
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) { ... }.
There was a problem hiding this comment.
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.
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. |
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.