| Summary: | Low resolution art url in plasma-browser-integration and kde-connect | ||
|---|---|---|---|
| Product: | [Plasma] plasma-browser-integration | Reporter: | RaitaroH <RaitaroHikami> |
| Component: | general | Assignee: | Kai Uwe Broulik <kde> |
| Status: | REPORTED --- | ||
| Severity: | normal | CC: | nate |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Neon | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
RaitaroH
2019-08-08 07:04:44 UTC
Thanks for your detailed analysis. However, website specific workarounds are outside the scope of this extension. If YouTube decided to provide only low resolution thumanils, that's all we got. Media Sessions API lets a website offer multiple sizes and many websites do. Open the developer console (Ctrl+Shift+I) and type navigator.mediaSession.metadata.artwork and you can see that YouTube only provides a single 320x180 thumbnail. (In reply to Kai Uwe Broulik from comment #1) > Thanks for your detailed analysis. However, website specific workarounds are > outside the scope of this extension. If YouTube decided to provide only low > resolution thumanils, that's all we got. Media Sessions API lets a website > offer multiple sizes and many websites do. > > Open the developer console (Ctrl+Shift+I) and type > navigator.mediaSession.metadata.artwork > and you can see that YouTube only provides a single 320x180 thumbnail. The command you priveded gives a link that is pretty much as so: `https://img.youtube.com/vi/<video-id>/hqdefault.jpg` followed by `?blablablabla` Except everything after `.jpg` is not needed, it still points to the image. Then this thing can be easily made into the required image by simply replacing `hqdefault` with `highresdefault` Ex: url: https://www.youtube.com/watch?v=xBQvKyAizt8 `navigator.mediaSession.metadata.artwork` --> `https://i.ytimg.com/vi/xBQvKyAizt8/hqdefault.jpg?.....` - I removed everything after ? becase is way too long. So now this can be easily modified to become `https://i.ytimg.com/vi/xBQvKyAizt8/hqdefault.jpg`. But what we need is this instead --> `https://i.ytimg.com/vi/xBQvKyAizt8/maxresdefault.jpg` Same res as the image got through youtube-dl. Can't plasma-browser-integration perform some modification on the link to get the higher res thing? I was able to even write this and get the link with pure javascript and no youtube api thing. I modified a little booklet I have to make this. ``` history.replaceState(window.location=(window.location+'').replace('watch?v=','').replace('www.youtube.com','i.ytimg.com/vi').replace(/\&list=(.+)/i,'').replace(/\&index=(.+)/i,'').concat('/maxresdefault.jpg'));location.reload(false); ``` Considering the above I actually modified my script to get thumbnails. I am aware this sorta formating has to be rewritten in the language plasma-browser-integration is written into.
`echo "$input" | awk -F'\\=' '{print "https://i.ytimg.com/vi/"$2"/maxresdefault.jpg"}'`
If the link is in the `navigator.mediaSession.metadata.artwork` format instead:
`echo "$inputg" | awk -F'/vi/' '{split($2,t,"/"); print "https://i.ytimg.com/vi/"t[1]"/maxresdefault.jpg"}'`
Both give the same maxres image.
|