YoutubeExplode: Forbidden on some videos

Some videos throws 403 Forbidden http exception, I tried to pass by constructor a new HttpClient with the right cookies to be loggedin.

Random video from logs: LanCLS_hIo4, 9ssRfVj92OA,

Any workaround?

Thanks

System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at YoutubeExplode.Internal.HttpClientEx.GetStreamAsync(HttpClient client, String requestUri, Nullable`1 from, Nullable`1 to, Boolean ensureSuccess)
   at YoutubeExplode.Internal.SegmentedHttpStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
   at YoutubeExplode.Internal.Extensions.CopyToAsync(Stream source, Stream destination, IProgress`1 progress, CancellationToken cancellationToken, Int32 bufferSize)
   at YoutubeExplode.YoutubeClient.DownloadMediaStreamAsync(MediaStreamInfo info, Stream output, IProgress`1 progress, CancellationToken cancellationToken)
   at YoutubeExplode.YoutubeClient.DownloadMediaStreamAsync(MediaStreamInfo info, String filePath, IProgress`1 progress, CancellationToken cancellationToken)
   at YoutubeExplode.Converter.YoutubeConverter.DownloadAndProcessMediaStreamsAsync(IReadOnlyList`1 mediaStreamInfos, String filePath, String format, IProgress`1 progress, CancellationToken cancellationToken)

image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 40 (8 by maintainers)

Most upvoted comments

Thanks @MeteorBurn

I’ve looked into it, I think I have an idea how to solve this. The issue is that to accommodate the changes, I have to rework some parts in the library. I have already started working on it, will hopefully finish it next week if I will have the time.

Will try on the weekend.

Will try on the weekend.

We look forward to hearing from you.

Don’t annoy! Expect with patience. Nobody owes anything to anyone here.

Soo @Tyrrrz will you try to fix this ?

Hey I found a couple of next videos with some errors. Maybe you could check this in next updates .

  1. I found some videos where no streams are returned but it throws exception with messages: _OTpbqtW5cY - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 64182 FJYcURdWtMo - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 52815., lang: AR TWo3bkPNhuo - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 66670 8OpY1fh8PmI - Unexpected end of content while loading JObject. Path ‘args’, line 1, position 71512 cEltMkG6auQ - Unexpected end of content while loading JObject. Path ‘args’, line 1, position 74353 VJy8qZ77bpE - Unexpected end of content while loading JObject. Path ‘args’, line 1, position 102055 hjGrY4dKofI - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 47346 huF4FWbAioY - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 85960
  2. In some videos there are also no streams and there is no age restriction: 7Gzc-qQaB8g, AdCWZ7Z2hek, dAwP9Yk0Kv0, Q2vR21RrtbU
  3. Some Videos returns 403. YT Explode returns streams but can’t download them (and also there is no age restriction)

There isn’t much videos from 1st and 2nd point, but i am letting you to know. I am not sure how much videos returns 403 and dont want download.

cEltMkG6auQ - 403 VJy8qZ77bpE - 403 hjGrY4dKofI - 403 Q2vR21RrtbU - 403 The rest of the videos are OK!

I think this is a problem with parameter parsing. Because with SaveFrom.net these videos can be downloaded, it link returns video page

YoutubeExplode: 4.7.16 YoutubeExplode.Converter: 1.4.3

You can download the second Video with the Version 4.7.15 of YoutubeExplode @TheTrigger

Yeah no 403, but sadly my downloads are still stuck endlessly

yesterday and today works, no 403! No changes!

Will try on the weekend.

We look forward to hearing from you.

@HelgeStiemerling Oh, didn’t know that this existed, but it’s doing the same just with FirstOrDefault.

But I don’t seem too get 403 anymore just endlessly stuck downloads. But before this 403 problem everything worked fine and I didn’t change anything.

It’s likely that whether or not someone gets 401 is dependent on their geolocation.

zO6UMuLr7t8

can’t download (403), but 5 minutes later download ok

???

need list with 403? i have 80+

Hey I found a couple of next videos with some errors. Maybe you could check this in next updates .

  1. I found some videos where no streams are returned but it throws exception with messages: _OTpbqtW5cY - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 64182 FJYcURdWtMo - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 52815., lang: AR TWo3bkPNhuo - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 66670 8OpY1fh8PmI - Unexpected end of content while loading JObject. Path ‘args’, line 1, position 71512 cEltMkG6auQ - Unexpected end of content while loading JObject. Path ‘args’, line 1, position 74353 VJy8qZ77bpE - Unexpected end of content while loading JObject. Path ‘args’, line 1, position 102055 hjGrY4dKofI - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 47346 huF4FWbAioY - Unterminated string. Expected delimiter: ". Path ‘args.player_response’, line 1, position 85960

  2. In some videos there are also no streams and there is no age restriction: 7Gzc-qQaB8g, AdCWZ7Z2hek, dAwP9Yk0Kv0, Q2vR21RrtbU

  3. Some Videos returns 403. YT Explode returns streams but can’t download them (and also there is no age restriction)

There isn’t much videos from 1st and 2nd point, but i am letting you to know. I am not sure how much videos returns 403 and dont want download.

Indeed it appears not. Only the first one is age restricted.

The first two videos @booonzo. Not sure what causes empty streams.

I think a lot of people are waiting for his recovery. I am also a victim of this current youtube-dl

Yeah, it doesn’t work on age restricted videos. Not 100% sure the fix will help with that. I know the youtube-dl project decided not to work around age restrictions and just not support them in general.

v4.7.15 not works in all videos. It worsk in most videos but i found many examples where it also returns 403 - check those for example: z0NfI2NeDHI or d_k5DUi_FqE

I’ve also noticed that in some videos it not returns any video and audio streams: m3I2maZOCfs, 64e9-y9gphE

XD3M5JN1uhg - this video returns message: Video [XD3M5JN1uhg] is unplayable beacuse it requires purchase, but i am not sure if you are able to fix this.

But the most important is 403 on many videos. I hope you will have some time son to fix it 😃

Cheers!

Yeah, I know. Currently, v4.7.15 should work because it doesn’t use embed page. I will invest some time into this issue later next week.

It seems Youtube has made changes that makes the old way of using embed to bypass age check not work any more. When using embed, the video now returns 403 error. There are similar issues with other programs, like youtube-dl.

As such, i think the whole method that uses embed is no longer working, and indeed, if you remove this line, all videos except age restricted videos work again.

I’m not sure if there is a solution atm for age restricted videos, apart from logging in.

YoutubeExplode: 4.7.16 YoutubeExplode.Converter: 1.4.3