kingsman142 / playlist-generator

Chrome Web Store Link (Playlist Generator) - https://chrome.google.com/webstore/detail/playlist-generator/gcnopleiakgahapanbdcegkccdifbbae
2 stars 1 forks source link

"Error: those folders don't contain any YouTube links!" #22

Closed hollandhr closed 3 months ago

hollandhr commented 3 months ago

First, love this add-on! The problem is I write a folder name and it just says there are no yt links there, like it doesn't recognize them...

kingsman142 commented 3 months ago

Hi @hollandhr . When did you first starting seeing this issue? Is that issue new as of the past week?

Also, how many songs are in the folder name? Would you be able to provide a screenshot of what you type into the extension and what your folder looks like?

hollandhr commented 3 months ago

The last time it worked was a month ago, then last week I tried and the error appeared. This folder has 56 yt bookmarks, no folders, and other site bookmarks. I tried with other folders (with 400 bookmarks and more) and nothing works. Thanks for looking into it. Screenshot 2024-06-04 165844 Screenshot 2024-06-04 170015

kingsman142 commented 3 months ago

Oh, so you're saying nothing in the extension is working for you?

If you right click the extension and click "Inspect Popup", wait for the window to appear, then click the extension button and type in the folder name as you usually would, do any errors appear?

Screenshot 2024-06-04 094050

hollandhr commented 3 months ago

Yes. In the console it says: "ERROR (Playlist Generator): Invalid returnDict.recentPlaylists; resetting both to their default value of empty lists []" Screenshot 2024-06-05 110232

kingsman142 commented 3 months ago

Hi @hollandhr . Just trying to gather a few pieces of information:

  1. Are you on Chrome or Firefox? It looks like you're on Chrome but I'd like to double check.
  2. Are you on the latest version of your browser?
    • For Chrome, you can find this by going to Settings -> Help -> About Chrome . My current version is 125.0.6422.142 .
  3. Is this issue still occurring?
  4. Above, you mention your folder does not contain any nested folders. Does your folder happen to live inside another folder?
  5. Does this issue occur for other folders you've created? You can test this by creating a temporary folder, adding probably 2 or 3 youtube bookmarks to them, and testing the extension.
  6. Have you updated to the latest version (v4.0.1) of the extension?
    • The reason I ask is because all developers of the extensions recently had to migrate from Manifest v2 to v3 since v2 is now deprecated; the deadline was this week. So I'm wondering if they might've cutoff your permissions/access.
    • You can do this by going to chrome://extensions (put it in the address bar) and clicking the "Update" button in the top-left on Chrome.

And then as a sanity check, you're using the exact folder name, no whitespace before or after the name, correct? I've been trying to reproduce the issue throughout the past week but haven't been able to do it via new folders, nested folders, Chrome/Firefox, etc., so I'm trying to figure out what might be going wrong.

hollandhr commented 3 months ago

Sure! Thanks for taking the time to look at it.

  1. I'm on Chrome
  2. Yes, using the latest ver.
  3. Same error.
  4. It's in another folder.
  5. OK this is new: it works when the bookmarks bar is 'rooted'. bookmarks bar -> playlist folder = works bookmarks bar -> new folder -> playlist folder = works bookmarks bar -> new folder -> tryout folder -> playlist folder = works other bookmarks -> playlist folder = doesn't work other bookmarks -> new folder -> playlist folder = doesn't work
  6. Yes, I have the latest ver.

The folder passed the sanity check =D

kingsman142 commented 3 months ago

That's fantastic news but also a very odd edge case. By "other bookmarks", are you referring to the "All Bookmarks" folder?

hollandhr commented 3 months ago

Yes, it's a weird one. But it makes sense since the problem is with recognizing the paths of the bookmarks, no? That's why you said to check the name of the folder, and why I tried moving the folder around. Yes 'all bookmarks', my Chrome is not in English...

kingsman142 commented 3 months ago

No worries haha. But yeah, the problem is around checking the name of the folder. I was able to reproduce the issue by creating a folder under "All Bookmarks" and the same error, "Those folders don't contain any YouTube links", appears.

I went back and checked whether the Chrome Bookmarks API even grants permissions to view "Other Bookmarks"/"All Bookmarks". I think this is what is happening when I call bookmarks.getTree():

Chrome [Bookmarks Manager] getTree()
 -> Bookmarks Manager (0th element)
 -> [Bookmarks bar, Other bookmarks] (children)
 -> Bookmarks bar (0th element)
 -> [x1, x2, x3, ..., xN] (the children a.k.a. all items on bookmarks bar)

When looking through the code, I currently do the following:

var bookmarksTree = chrome.bookmarks.getTree();
var bookmarksNodes = bookmarksTree[0]["children"];
var bookmarksBar = bookmarksNodes[0]; // 0th index is BookmarksBar, 1st index is "Other Bookmarks"

If you'll notice, I only pull out the bookmarks bar but not the Other Bookmarks. I think I need to update this code to loop over both. The plan is to make this change and test it out sometime this week and push out a release.

hollandhr commented 3 months ago

Interesting, so 'Other bookmarks' is not a child of 'Bookmarks bar' but another node... Why not pull out the whole 'tree' instead of pulling each one and iterating over both?

kingsman142 commented 3 months ago

Yeah, that's correct and a totally valid question as well. In general, the extension was originally built for my use-cases and I didn't know if 1) Other/All Bookmarks was a temporary feature or if it would remain for years into the future (which we've seen is the case here), 2) whether Other/All bookmarks was even being used by anybody (I store all my folders on the bookmarks bar itself), and 3) whether Other/All bookmarks would add some niche technical functionality that would introduce some breaking changes for the extension.

On that 3rd point, your folder says "Other Bookmarks" but mine says "All Bookmarks". If I assume "All Bookmarks" is a literally just all your bookmarks on the bookmarks bar, but just in a mega-folder, it would be redundant to search for bookmarks in this folder because they'd just have a bunch of duplicates. And second, if at any point they took folders from the bookmarks bar and moved them to "All Bookmarks", then you started using the extension and entered "Music" as your folder name, it would pull the "Music" folder from the bookmarks bar and the "Music" folder from All Bookmarks, resulting in duplicates in your playlist.

With that being said, all the above seem to not be the case and it's safe to use Other/All Bookmarks.

kingsman142 commented 3 months ago

@hollandhr This fix should be deployed within a week to the web store. I've tested it locally and it should be working.