Closed ronvoluted closed 3 years ago
The problem with the trailing slash was with my code. I have since fixed that, but I cannot push it until I finish my current YouTube API compliance review.
The problem with certain channels not working at all is due to a limitation with the YouTube API. There is no way to get a channel from its custom URL, so popyt sort of mimics this by grabbing the end of the URL and searching for it. In the case of "fosterkittensofficial", their actual username is "Cindy Congdon", so "fosterkittensofficial" returns no results (and if it did, they would most likely be garbage). I have also edited the documentation of the getChannel()
function to clarify this.
Once my compliance review is complete, I will push these new changes and close this issue. Thanks!
No worries and no rush! Glad a cause could be found.
Yeah for urls where there's no id or username, I just grabbed the html as is then regexed the id:
/(?<="channelId":")[A-Za-z0-9]{24}/g
/(?<="externalId":")[A-Za-z0-9]{24}/g
/(?<="browseId":")[A-Za-z0-9]{24}/g
Wasn't sure if channelId
was always present so the other two are just fallbacks.
I would add this, but the wrapper is purely meant to use the YouTube Data v3 API. The frontend can change unexpectedly, so scraping the website isn't an option. A good solution for anyone that really wants to be able to get a channel by its custom URL, though.
On Wed, Feb 17, 2021 at 11:51 PM Ron Au notifications@github.com wrote:
No worries and no rush! Glad a cause could be found.
Yeah for urls where there's no id or username, I just grabbed the html as is then regexed the id:
/(?<="channelId":")[A-Za-z0-9]{24}/g /(?<="externalId":")[A-Za-z0-9]{24}/g/(?<="browseId":")[A-Za-z0-9]{24}/g
Wasn't sure if channelId was always present so the other two are just fallbacks.
â You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/jasonhaxstuff/popyt/issues/297#issuecomment-781048396, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRI62R7B7SDW5RR2J7LPJDS7SMEZANCNFSM4VTH2FSQ .
Oh 100% agreed, just an account of how one person ended up resolving it.
This may be a YouTube limitation but reporting here in case it's otherwise. If you try
getChannel()
with this URL it will fail with "Item not found" error:https://www.youtube.com/c/ChilledCow
but the same URL with a trailing slash will work just fine:
https://www.youtube.com/c/ChilledCow/
Using just "ChilledCow" also works. However, other channels do not work even with trailing slash or with only the end path.
When I load those failing URLs in the browser, they load fine and I can't discern any particular difference between the working and non-working URLs. Thank you for the library! đđźââď¸