I did answered thoroughly to precisely your kind of inquiry quite recently. I'd warmly recommend you to absorb these two posts:
How to get a YouTube channel ID from the channel's username which includes Cyrillic characters and
Obtaining a channel id from a youtube.com/c/xxxx link?
Here, I'll only emphasize that the forUsername
request parameter has the following official specification:
forUsername (string)
The forUsername
parameter specifies a YouTube username, thereby requesting the channel associated with that username.
But, the name NAME
under an URL of form:
https://www.youtube.com/c/NAME
is not necessarily the YouTube username of the respective YouTube channel. NAME
is that channel's custom URL, a different category.
According to an official Google staff post from 2013-07-11, it's not a requisite that every channel have attached an username. Google's issue tracker records even a forCustomUrl
feature request that has been rejected for the time being (at least for the API's road map of 2020).
The second post I quoted above provides an algorithm that'll produce the channel ID associated to a given custom URL. Moreover, that post also provides a Python function that implements the algorithm.
A public (MIT licensed) Python 3 script -- youtube-search.py
-- is linked to that post too; the script implements both the custom URL algorithm and the forUsername
API querying.
This script produces the following outputs when invoked with each of the searched names your post above contains:
$ python3 youtube-search.py --user-name YouTube
UCBR8-60-B28hp2BmDPdntcQ
$ python3 youtube-search.py --custom-url YouTube
youtube-search.py: error: custom URL "YouTube": no associated channel found
$ python3 youtube-search.py --user-name H2ODelerious
youtube-search.py: error: user name "H2ODelerious": no associated channel found
$ python3 youtube-search.py --custom-url H2ODelerious
youtube-search.py: error: custom URL "H2ODelerious": no associated channel found
$ python3 youtube-search.py --search-term H2ODelerious --type=channel
UCClNRixXlagwAd--5MwJKCw: H2ODelirious
UCagP0Z1PVAAOpYV4HKy6w9w: H2o Delerious
UC6x4XQ6cqBzxGlSlCwcyUBw: H2O Delerious
UCzOeqwelmnbBDf3bIHde0EQ: H2O Delerious
UCLmpVRE4XIEem_1EwHxqtXQ: H2O Delerious plays
UCxxWGzT90DG1gk2pnvcRt2w: h2o delerious fan artist
UCYH7TzSISrC-2Mfy3TyjUDQ: H2O DELERIOUS Flores
UCfRjtX1qzFbCptULo529HsA: Jbz2swag
UCYd0SDTRQ54K1UQ-OkQd_7w: Jehowen
UCjozfwXXP7bEGPDFpAtgsYQ: LittleCool Me
$ python3 youtube-search.py --user-name leagueoflegends
UCvewcgPDiYrVNiyh8kpOnFQ
$ python3 youtube-search.py --custom-url leagueoflegends
UC2t5bjwHdUX4vM2g8TRDq5g
$ python3 youtube-search.py --user-name playoverwatch
UCM9KGdihR14QHFeyOsA-kgA
$ python3 youtube-search.py --custom-url playoverwatch
UClOf1XXinvZsy4wKPAkro2A
Note that youtube-search.py
requires a valid API key to be passed to it as argument of the command line option --app-key
or, otherwise, passed on as the environment variable YOUTUBE_DATA_APP_KEY
. (Use the command line option --help
for brief helping info.)
Also note that among the channels resulted from invoking the search script through:
$ python3 youtube-search.py --search-term H2ODelerious --type channel
,
only two have the customUrl
property set, as follows:
$ python3 youtube-search.py --channel-url UCClNRixXlagwAd--5MwJKCw
h2odelirious
$ python3 youtube-search.py --channel-url UCYd0SDTRQ54K1UQ-OkQd_7w
jehowen