youtube-music icon indicating copy to clipboard operation
youtube-music copied to clipboard

[DEPRECATED] Local Subscriptions Plugin

Open fdr-smnv opened this issue 3 years ago • 1 comments

As the title says this plugin allows the user to save subscriptions locally without google account. It adds 'Subscriptions' tab in the menu which opens new window with the list of user's local subscriptions that can be opened in the main window. I think this plugin would go hand in hand with no-google-login plugin. Also I'm fairly new to electron so I'm pushing this plugin early to hopefully get some feedback and advice.

What works:

  • Subscribing to music channels with subscribe button
  • Saving subscription in plugin options
  • New menu tab button
  • Tab button opens window with subscriptions list
  • Subscription list item on click redirects main window to channel url

Issues/TODO:

  • Couldn't manage to call functions from prerender without contextBridge
  • Initial load doesn't render sub button
  • loadURL makes full page rerender. If possible it would be great if user could click channel in the list and get redirected without slow full page refresh
  • No styles for subs list & buttons
  • (Probably issue) Saving subscription data in plugin options
  • Ability to sort and filter saved channels
  • Export subscription data?

fdr-smnv avatar Jun 27 '21 20:06 fdr-smnv


loadURL makes full page rerender. If possible it would be great if user could click channel in the list and get redirected without slow full page refresh

  • You can use the method that I found to navigate to youtube-music pages without reloading:
const browseId = 'UCO8fwuNOHp3wujDbfRJATzQ'
$('ytmusic-app').navigate_(browseId)

  • I think this would greatly benefit of using the new custom prompt (#243) for the popup
    • will probably needs a new kind of prompt (List) which should be easy to implement there
    • Still needs some more styling of sub button

  • Why listen for the css injection finish event? I think it shouldn't matter - you could immediately add the local subscriptions button to the menu

https://github.com/th-ch/youtube-music/blob/4f8c2289433f708a74bdbefea023bacc0e550f3f/plugins/local-subscriptions/back.js#L14 https://github.com/th-ch/youtube-music/blob/4f8c2289433f708a74bdbefea023bacc0e550f3f/plugins/local-subscriptions/front.js#L12


This plugin could also allow "subscribing" to playlist which would resolve #363 /Albums/Artists/?Songs? to get browseId from page use

const browseId=
$('ytmusic-app').__data.mainContentData_.endpoint.data.browseId

(current page is an album if browseId starts with MPLAUC, artist if it starts with UC) can also be checked using

const pageType =
$('ytmusic-app').__data.mainContentData_.endpoint.data
  .browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType;

const expectedResults = [
  'MUSIC_PAGE_TYPE_ARTIST',
  'MUSIC_PAGE_TYPE_ALBUM',
  'MUSIC_PAGE_TYPE_PLAYLIST'
]

(btw this whole thing is more "bookmarks" than "subscriptions" but the latter sounds better so whatever 😅


Optionally if we want to capture an icon for the page (Channel/Artist/Playlist/Album) this could work:

function getPageThumbnail() {
    const header = $('ytmusic-app').__data.mainContentData_.response.header;
    const headerRenderer = header.musicImmersiveHeaderRenderer || header.musicDetailHeaderRenderer || header.musicVisualHeaderRenderer;
    const thumbnailType = headerRenderer.foregroundThumbnail || headerRenderer.thumbnail;
    const thumbnailRenderer = thumbnailType.musicThumbnailRenderer || thumbnailType.croppedSquareThumbnailRenderer;
    const thumbnails = thumbnailRenderer.thumbnail.thumbnails;
    
    if (!thumbnails || thumbnails.length <= 0) return '';
    return thumbnails[thumbnails.length - 1].url.replace(/=.*/, '=w100-h100-p-l90-rj');
}

Maybe add an option to disable the normal library button


@fdr-smnv contact me on discord(Araxeus#0819) or here if u wanna do some changes because I'm also trying some stuff out

Araxeus avatar Oct 24 '21 19:10 Araxeus