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

Add handing for N-parameter in URLs #601

Closed
wants to merge 2 commits into from
Closed

Conversation

omansak
Copy link
Contributor

@omansak omansak commented Nov 4, 2021

@Tyrrrz Tyrrrz changed the title added URL's "n" parameter scrambler Add handing for N-parameter in URLs Nov 4, 2021
@Tyrrrz
Copy link
Owner

Tyrrrz commented Nov 4, 2021

Thanks!
Am I right to assume it closes #599?

@Tyrrrz
Copy link
Owner

Tyrrrz commented Nov 4, 2021

Your first link also mentions that this can be avoided altogether by masking requests as Android. Can we just do that? It seems like a way simpler solution.

curl --request POST \
  --url 'https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' \
  --header 'Content-Type: application/json' \
  --header 'Origin: https://www.youtube.com' \
  --header 'X-YouTube-Client-Name: 3' \
  --header 'X-YouTube-Client-Version: 16.20' \
  --data '{
	"context": {
		"client": {
			"clientName": "ANDROID",
			"clientVersion": "16.20",
			"hl": "en"
		}
	},
	"videoId": "dQw4w9WgXcQ",
}'

image

@omansak
Copy link
Contributor Author

omansak commented Nov 4, 2021

Thanks! Am I right to assume it closes #599?

also #573

@omansak
Copy link
Contributor Author

omansak commented Nov 4, 2021

Your first link also mentions that this can be avoided altogether by masking requests as Android. Can we just do that? It seems like a way simpler solution.

curl --request POST \
  --url 'https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' \
  --header 'Content-Type: application/json' \
  --header 'Origin: https://www.youtube.com' \
  --header 'X-YouTube-Client-Name: 3' \
  --header 'X-YouTube-Client-Version: 16.20' \
  --data '{
	"context": {
		"client": {
			"clientName": "ANDROID",
			"clientVersion": "16.20",
			"hl": "en"
		}
	},
	"videoId": "dQw4w9WgXcQ",
}'

image

Probably, slow bitrate problem will be solved with ANDROID client name but I chose definitive solution for WEB clients.

@Tyrrrz
Copy link
Owner

Tyrrrz commented Nov 5, 2021

Your first link also mentions that this can be avoided altogether by masking requests as Android. Can we just do that? It seems like a way simpler solution.

curl --request POST \
  --url 'https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' \
  --header 'Content-Type: application/json' \
  --header 'Origin: https://www.youtube.com' \
  --header 'X-YouTube-Client-Name: 3' \
  --header 'X-YouTube-Client-Version: 16.20' \
  --data '{
	"context": {
		"client": {
			"clientName": "ANDROID",
			"clientVersion": "16.20",
			"hl": "en"
		}
	},
	"videoId": "dQw4w9WgXcQ",
}'

image

Probably, slow bitrate problem will be solved with ANDROID client name but I chose definitive solution for WEB clients.

Let's start with Android solution for now in a different PR and keep this one around for later, in case YouTube breaks that one too. Would you create a PR for that?

@omansak
Copy link
Contributor Author

omansak commented Nov 7, 2021

I looked again and we cant this. Because https://www.youtube.com/youtubei/v1/player the request gives all information for video. Just look this https://reqbin.com/c-7zqbnajr . We must to parse response and get the Video HTML5 URL which URLs does not need any process, URL's works perfectly. I didn't like this method for YoutubeExplode.

@@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.14.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="NiL.JS" Version="2.5.1514" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this without interpreting JS somehow?

@MihaZupan
Copy link

We must to parse response and get the Video HTML5 URL which URLs does not need any process, URL's works perfectly. I didn't like this method for YoutubeExplode.

@omansak can you elaborate on why the Android approach can't be used in this library?

@FrostySo
Copy link

FrostySo commented Dec 5, 2021

@omansak can you elaborate on why the Android approach can't be used in this library?

"Probably, slow bitrate problem will be solved with ANDROID client name but I chose definitive solution for WEB clients."

Which I find absurd because the first solution is more likely to cause issues than the second. The solution for android will always exist because how else will Youtube operate for non js platforms?

@Tyrrrz
Copy link
Owner

Tyrrrz commented Dec 9, 2021

For now went with the Android solution, let's see how long it lasts. All things considered, it's definitely simpler than the alternative.

@Tyrrrz Tyrrrz added the wontfix label Jan 10, 2022
@Tyrrrz
Copy link
Owner

Tyrrrz commented Jan 10, 2022

Going to close for now since we went with the Android solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants