Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel custom url unsupported #1

Closed
mattwright324 opened this issue Sep 7, 2020 · 6 comments
Closed

Channel custom url unsupported #1

mattwright324 opened this issue Sep 7, 2020 · 6 comments
Labels
cantfix An issue that I can't completely fix

Comments

@mattwright324
Copy link
Owner

mattwright324 commented Sep 7, 2020

Issue

There exists a custom channel url youtube.com/c/custom_url or youtube.com/custom_url different from the legacy username url youtube.com/user/username. There is no direct way to query for the custom URL value officially in the YouTube API.

Custom URL Resolving

Built into the tool is a custom method to attempt to resolve this URL to the actual channel. It will use the value of the custom channel URL in a search.list call filtered to channels, pass those channels to a channels.list, and try to match the channel property customUrl to the value in the submitted URL. It will try the first 3 pages (of 50 results per page) before giving up.

After finding the channel-id URL, it will replace the input and share-link using the channel-id URL instead. This is so that it does not have to do the resolving every time if the result is shared.

If the resolver could not find anything, it will display an error and link to this issue page.

Manually Resolving

It is possible to manually find the channel id for a custom channel URL if the custom resolver fails to find it.

Method 1: Uploaded Video

This method should always work though it isn't the channel directly. You will get extra detail about the video you selected but the channel details will be listed under the video section.

  1. Navigate to the channel with the custom channel URL in your browser. Such as https://www.youtube.com/c/creatoracademy
  2. Click on a public video uploaded by that user and copy the video url. Such as https://www.youtube.com/watch?v=OrzMIhLpVps
  3. Paste the video URL into YouTube Metadata and submit.

Method 2a: Inspect Element

This method should always work though if this seems too complicated, try Method 1 instead.

  1. Navigate to the channel with the custom channel URL in your browser. Such as https://www.youtube.com/c/creatoracademy
  2. Open your browser developer tools with F12 or Right click -> Inspect Element (Firefox) or Right click -> Inspect (Chrome)
  3. In the Inspector tab (Firefox) or Elements tab (Chrome), CTRL+F and search for the string og:url. Copy this URL.
  4. Paste the channel-id URL into YouTube Metadata and submit.

Method 2b: Console JS

This method should always work though if this seems too complicated, try Method 1 instead.

  1. Navigate to the channel with the custom channel URL in your browser. Such as https://www.youtube.com/c/creatoracademy
  2. Open your browser developer tools with F12 or Right click -> Inspect Element (Firefox) or Right click -> Inspect (Chrome)
  3. In the Console tab paste the following line and hit enter. Copy the output which will be the channel-id URL.
document.querySelector("meta[property='og:url']").content
  1. Paste the channel-id URL into YouTube Metadata and submit.
@mattwright324
Copy link
Owner Author

I tried submitting a feature request to Google to add an additional parameter supporting the custom channel url but was rejected, there also seems to have been a similar request some months before also rejected. It is being rejected because it is "infeasible" which I guess means it would be difficult to implement... and isn't in the roadmap this year.

@staedtlernorica
Copy link

staedtlernorica commented Feb 12, 2021

I faced a similar problem in my own program, and I gave up parsing the c/channel/user/ input using the youtube api. What I did was given a channel's url, I would go to the videos tab page, go to the first video there, and use the youtube api to get the json data about that channel. Inside that json data is the channel id, which you can use to uniquely identify the channel. This makes it so that the c/channel/user distinction no longer matters, and always return the correct channel.

EDIT: Since I just noticed you wrote it in JS, I should mention I wrote this using python using requests and beautifulsoup. I think that JS will also have similar tools to side step this silly issue too.

@mattwright324
Copy link
Owner Author

The problem with trying to ajax the page content is CORS errors with JS from the browser since its a client side app. I also think it is against terms to query the webpage but not sure about that.

@mattwright324
Copy link
Owner Author

I've found it is possible to get around the CORS issue by using a proxy such as https://cors.eu.org/

@Papoulka
Copy link

Thanks. I used Method 2a "Inspect Element" which worked immediately to add a "/c" channel to YTS.

@mattwright324
Copy link
Owner Author

I've now replaced resolving for all 3 vanity formats (@, user, custom) to use the innertube resolve_url method which should be much faster and more reliable.

/~https://github.com/mattwright324/youtube-api-proxy/blob/main/server.mjs#L78-L93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cantfix An issue that I can't completely fix
Projects
None yet
Development

No branches or pull requests

3 participants