0

I am fetching data from YouTube channels using file_get_contents. Some channels, although they exist in reality, have URLs that do not open (404 not found). When accessing the channel using a different username and clicking on the about page, the URL that was previously showing 404 not found becomes active. When directly clicked, it shows 404 not found, but it works when clicking on the other URL. I don't normally know the accessible URLs; I found them on Google. I believe this is a YouTube bug. How can I overcome this issue? My goal is to be able to access those URLs that actually exist but are not opening. Example url, there are 100s of problematic urls like these:

problem url: https://www.youtube.com/@budhasubbamusic/about (Clicking on this will not open.)
active url: https://www.youtube.com/channel/UCNR1KcWXj7zpWQFJtU3ddYg (Click on this and then click on the about page, it will revert to the same state as the unresponsive, 404 not found URL above. So, in reality, the URL above exists.)

p: https://www.youtube.com/@PrettyRomantic/about
a: https://www.youtube.com/channel/UCrvdMsIjkBv5VPUMZjSojaA

p: https://www.youtube.com/@KurulusOsman/about
a: https://www.youtube.com/channel/UCGR1XmkoQedeJMT2ajRHvsw

https://www.youtube.com/@EMHD/about
https://www.youtube.com/c/EkremMontage

https://www.youtube.com/@DrHazemShouman/about
https://www.youtube.com/DrHazemShouman

https://www.youtube.com/@GoalBrasil/about
https://www.youtube.com/c/goalbrasil

https://www.youtube.com/@AFKEER/about
https://www.youtube.com/c/AFKEER/
?

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
PLuToNiuM
  • 53
  • 10
  • It seems that you are right concerning this YouTube UI issue, however I don't know how you can report this issue to YouTube (note that as far as I know they don't check Stack Overflow). Let's try to help you despite the YouTube UI issue, what is precisely your problem? Like are you looking for resolving `@budhasubbamusic` to `UCNR1KcWXj7zpWQFJtU3ddYg` (or the other way around)? – Benjamin Loison Jul 03 '23 at 13:01
  • My goal is to be able to access those URLs that actually exist but are not opening. For that, I tried to find the channel ID from the username using YouTube Data API v3 , https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q=@handle&key=$apiKey . However, since the YouTube Data API v3 does not support @handle, not every user's ID can be accurately found. – PLuToNiuM Jul 03 '23 at 13:25
  • Do you have an example of handle which isn't brought as the first result of your [YouTube Data API v3](https://developers.google.com/youtube/v3) [Search: list](https://developers.google.com/youtube/v3/docs/search/list) endpoint use (cf your notion of *accuracy*)? If so, please share this handle example. – Benjamin Loison Jul 03 '23 at 13:37
  • Yes. since the YouTube Data API v3 does not support @handle, not every user's ID can be accurately found. Example: https://www.youtube.com/@atv (There are hundreds of examples and more like this.) – PLuToNiuM Jul 09 '23 at 14:43
  • Does [this answer](https://stackoverflow.com/a/75843807) solve your problem? – Benjamin Loison Jul 09 '23 at 16:26
  • No, this is not a complete solution. – PLuToNiuM Jul 09 '23 at 18:01
  • So what is your problem, if you're able to get the channel id associated to a given channel handle? – Benjamin Loison Jul 09 '23 at 18:04
  • No, you cannot get the exact channel ID of each channel. for example you can't find the channel id of this channel with related tools or using youtube data api v3. Example: https://youtube.com/@atv (There are hundreds of examples and more like this.) – PLuToNiuM Jul 09 '23 at 18:11
  • I still don't understand your issue, according to the answer I mentioned, the id of this channel for instance is [`UCBhKJbmmrohyHGWR7T-l3fw`](https://www.youtube.com/channel/UCBhKJbmmrohyHGWR7T-l3fw) thanks to https://yt.lemnoslife.com/channels?handle=@atv – Benjamin Loison Jul 09 '23 at 18:16
  • Benjamin, I think you are the owner of lemnoslife. What YouTube Data API v3 query did you use for the URL you provided (yt.lemnoslife.com/channels?handle=@atv)? For example, I manually use this query: (https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q=@atv&key=$apikey), but it doesn't give me the same ID number that you found? Example: https://yt.lemnoslife.com/noKey/search?part=snippet&type=channel&q=@atv ? – PLuToNiuM Jul 10 '23 at 11:02
  • I confirm being the owner of https://yt.lemnoslife.com. As described in my answer, my API is open-source, so you call look [how it works](https://github.com/Benjamin-Loison/YouTube-operational-API/blob/8301b3164511d86c6af5b70cd688460e2c01a42e/channels.php#L48-L49) on your own. To summarize it quickly, this endpoint doesn't rely on YouTube Data API v3 but YouTube UI web-scraping. – Benjamin Loison Jul 10 '23 at 11:05
  • problem url-not working:: https://www.youtube.com/@SuperhitBengaliTV/about original channel id url: https://www.youtube.com/channel/UCaulKoJD6od1_-8b-Cy1zYA Unfortunately, the ID couldn't be found on your website: Example: https://yt.lemnoslife.com/channels?handle=@SuperhitBengaliTV I can give you hundreds of examples like this. It seems that there is no real solution. – PLuToNiuM Jul 10 '23 at 11:37
  • I apologize for any misunderstanding. I believe you now understand what I'm trying to convey. – PLuToNiuM Jul 10 '23 at 11:53
  • Do you have an example of such channel handle that can't be resolved to a channel id and isn't the first result of https://yt.lemnoslife.com/noKey/search?q=HANDLE&type=channel? The first result for `@SuperhitBengaliTV` is correctly `UCaulKoJD6od1_-8b-Cy1zYA`. Otherwise there doesn't seem to be any workaround. – Benjamin Loison Jul 10 '23 at 15:02
  • I will try to find a permanent solution. Thank you for your answer. – PLuToNiuM Jul 10 '23 at 15:40

0 Answers0