Closed CamFlyerCH closed 1 year ago
Ah yea I'll have to see if I can improve this. It happens on occasion because the way to get info using a URL, you have to technically do a 'search' query, and sometimes the API responds with a weird result for some channels.
Another example of going to the wrong channel Pasting this url: https://www.youtube.com/c/Berdboi Ends up going to this channel: https://www.youtube.com/channel/UCB8AUVOI8XRhlbDOOX3qK5A
Copying this comment I made in #624 :
A couple things to add that I've found. The YouTube API offers absolutely zero way to do a direct query to retrieve the channel ID if the /c/ channel URL is given, for some reason. It does however, offer a way to directly get the channel ID if it's a legacy username, so for "youtube.com/whatever", you can query for just "whatever". (Except apparently not always? See example below)
The problem with that is, sometimes the /c/ name is different from the legacy name. So if I were to add a thing to query the username "mkbhd" for example, it actually returns this channel id: UCmf_VrB73I-eJ3fq0adaOkg, which is not MKBHD's main channel: https://www.youtube.com/channel/UCmf_VrB73I-eJ3fq0adaOkg
In fact, it's not even the same channel that comes up if you type in youtube.com/mkbhd. (I think at some point, YouTube started using the /c/whatever URL if someone typed in just youtube.com/whatever. So unless they're the same, it might not give the same result) So there's not really any perfect solution.
The best method I found to get the ID is a follows:
That is quite fast. I am happy with that workaround.
I have the same issue.
I have the same issue.
Then the best solution is still to use the ID instead of the old custom URL
Python 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> from bs4 import BeautifulSoup
>>> resp = requests.get('https://www.youtube.com/c/NimaGmbHWellnesspoolsOstermundigen')
>>> soup = BeautifulSoup(resp.text, 'html.parser')
>>> channel_id = soup.select_one('meta[property="og:url"]')['content'].strip('/').split('/')[-1]
>>> channel_id
'UCV3I8eXxn3GW4Vwi465Nzeg'
>>> #real channel URL : https://www.youtube.com/channel/UCV3I8eXxn3GW4Vwi465Nzeg
>>> resp = requests.get('https://www.youtube.com/c/RitaInderm%C3%BChle')
>>> soup = BeautifulSoup(resp.text, 'html.parser')
>>> channel_id = soup.select_one('meta[property="og:url"]')['content'].strip('/').split('/')[-1]
>>> channel_id
'UCGktqHoMUkhnTxaK-9KVJmQ'
>>> # real channel url: https://www.youtube.com/channel/UCGktqHoMUkhnTxaK-9KVJmQ
>>> resp = requests.get('https://www.youtube.com/c/Berdboi')
>>> soup = BeautifulSoup(resp.text, 'html.parser')
>>> channel_id = soup.select_one('meta[property="og:url"]')['content'].strip('/').split('/')[-1]
>>> channel_id
'UCRei8TBpt4r0WPZ7MkiKmVg'
>>> # real channel url: https://www.youtube.com/channel/UCRei8TBpt4r0WPZ7MkiKmVg
In the HTML of the custom-named URLs, you can find:
All you have to do is pull it out👍
Python 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import requests >>> from bs4 import BeautifulSoup >>> resp = requests.get('https://www.youtube.com/c/NimaGmbHWellnesspoolsOstermundigen') >>> soup = BeautifulSoup(resp.text, 'html.parser') >>> channel_id = soup.select_one('meta[property="og:url"]')['content'].strip('/').split('/')[-1] >>> channel_id 'UCV3I8eXxn3GW4Vwi465Nzeg' >>> #real channel URL : https://www.youtube.com/channel/UCV3I8eXxn3GW4Vwi465Nzeg >>> resp = requests.get('https://www.youtube.com/c/RitaInderm%C3%BChle') >>> soup = BeautifulSoup(resp.text, 'html.parser') >>> channel_id = soup.select_one('meta[property="og:url"]')['content'].strip('/').split('/')[-1] >>> channel_id 'UCGktqHoMUkhnTxaK-9KVJmQ' >>> # real channel url: https://www.youtube.com/channel/UCGktqHoMUkhnTxaK-9KVJmQ >>> resp = requests.get('https://www.youtube.com/c/Berdboi') >>> soup = BeautifulSoup(resp.text, 'html.parser') >>> channel_id = soup.select_one('meta[property="og:url"]')['content'].strip('/').split('/')[-1] >>> channel_id 'UCRei8TBpt4r0WPZ7MkiKmVg' >>> # real channel url: https://www.youtube.com/channel/UCRei8TBpt4r0WPZ7MkiKmVg
I already khow that.
See https://github.com/ThioJoe/YT-Spammer-Purge/discussions/655
uh close the issue, that is inactive?
uh close the issue, that is inactive?
Issues are not closed until resolved, is this issue resolved? I cannot test the latest version right now 👍
?????????????????
This should be improved in the latest beta. Turns out there is a way to filter the API search results to only be channels, whereas before it would search videos and channels, which would often return bad results for small channels.
Now it should be a lot less likely to return false channel results. And if the API doesn't return it at all for some reason, which it still might do for small channels, the result should be empty and at least tell the user that.
Oh, that makes sense! I'm so glad this is fixed because it was pretty annoying in the past.
Oh, that makes sense! I'm so glad this is fixed because it was pretty annoying in the past.
It still doing this to me and the linked helps didn't help me...
Duplicate Issues
What happened?
Wenn I try to scann recent videos from some friends channels, the link get's decoded to the wrong channel.
Example: https://www.youtube.com/c/NimaGmbHWellnesspoolsOstermundigen
I found by clicking on a subscribed channel list a link with an ID for the same channel: https://www.youtube.com/channel/UCV3I8eXxn3GW4Vwi465Nzeg
Also this one did not work, but there is an umlaut in it: https://www.youtube.com/c/RitaInderm%C3%BChle
Is there a way to improve the detection of the right channel or is there a way to find the channel ID (link) with some easy method ?
Release version
2.14.0
Steps to reproduce
What platform are you seeing this problem on?
Windows (.exe file)
Relevant log output
No response
Screenshots