youtube_explode_dart icon indicating copy to clipboard operation
youtube_explode_dart copied to clipboard

[Bug]: VideoUnavailableException even though the video is available on youtube

Open spiderion opened this issue 11 months ago • 13 comments

What happened?

VideoUnavailableException: Video 'YQHsXMglC9A' is unavailable In most cases, this error indicates that the video doesn't exist, is private, or has been taken down. If you can however open this video in your browser in incognito mode, it most likely means that YouTube changed something, which broke this library. Please report this issue on GitHub in that case.

Stacktrace / error logs.

VideoUnavailableException: Video 'YQHsXMglC9A' is unavailable
In most cases, this error indicates that the video doesn't exist, is private, or has been taken down.
If you can however open this video in your browser in incognito mode, it most likely means that YouTube changed something, which broke this library.
Please report this issue on GitHub in that case.

Package (youtube_explode_dart) version

2.3.6

Checklist

  • [X] I have provided a descriptive title
  • [X] I have searched the issues of this repository and believe that this is not a duplicate
  • [X] I have tested with the latest version of the library
  • [X] (If relevant) I can open the video/playlist in a incognito/private window without being logged in.
  • [X] I have sponsored the project

Additional notes

No response

spiderion avatar Dec 30 '24 23:12 spiderion

Same problem, when 5-10 min later giving this error. Can anyone help us?

emreozdemir9 avatar Jan 02 '25 21:01 emreozdemir9

same issue

Purehi avatar Jan 03 '25 03:01 Purehi

i get this error if when i use mobile data.

anandssm avatar Jan 11 '25 18:01 anandssm

We have the same issue.

For me it works well when I am on Wifi, but throws exception when I am on mobile data. However, for a coworker, it works well on mobile data and throws exception on Wifi 😕

We noticed this video is a live that turned into a video 5 hours ago... so this may be the issue

Video 'an-ogV9u0kw' is unavailable
In most cases, this error indicates that the video doesn't exist, is private, or has been taken down.
If you can however open this video in your browser in incognito mode, it most likely means that YouTube changed something, which broke this 
Please report this issue on GitHub in that case.)

raulmabe-labhouse avatar Jan 24 '25 18:01 raulmabe-labhouse

I'm not able to reproduce this issues, often youtube implements some features only in certain geographical areas, try to enable verbose logging and send the output here.

// Before any YoutubeExplode code
Logger.root.level = Level.FINER;
Logger.root.onRecord.listen((e)  {
  print(e);
  if (e.error != null) {
   print(e.error);
   print(e.stackTrace);
  }
});

Hexer10 avatar Jan 25 '25 10:01 Hexer10

I'm not able to reproduce this issues, often youtube implements some features only in certain geographical areas, try to enable verbose logging and send the output here.

// Before any YoutubeExplode code Logger.root.level = Level.FINER; Logger.root.onRecord.listen((e) { print(e); if (e.error != null) { print(e.error); print(e.stackTrace); } });


I/flutter (27480): [FINE] YoutubeExplode.HttpClient: Sending request: GET https://www.youtube.com/watch?v=i2mV0LApDTA&bpctr=9999999999&has_verified=1&hl=en
I/flutter (27480): [FINE] YoutubeExplode.HttpClient: Sending request: GET https://www.youtube.com/watch?v=i2mV0LApDTA&bpctr=9999999999&has_verified=1&hl=en
I/flutter (27480): [FINE] YoutubeExplode.HttpClient: Sending request: GET https://www.youtube.com/watch?v=i2mV0LApDTA&bpctr=9999999999&has_verified=1&hl=en
I/flutter (27480): [FINE] YoutubeExplode.HttpClient: Sending request: GET https://www.youtube.com/watch?v=i2mV0LApDTA&bpctr=9999999999&has_verified=1&hl=en
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request headers: {User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.18 Safari/537.36, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, Accept-Language: en-us,en;q=0.5, Sec-Fetch-Mode: navigate, Cookie: PREF=hl=en&tz=UTC; SOCS=CAI; GPS=1}
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request headers: {User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.18 Safari/537.36, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, Accept-Language: en-us,en;q=0.5, Sec-Fetch-Mode: navigate, Cookie: PREF=hl=en&tz=UTC; SOCS=CAI; GPS=1}
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request headers: {User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.18 Safari/537.36, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, Accept-Language: en-us,en;q=0.5, Sec-Fetch-Mode: navigate, Cookie: PREF=hl=en&tz=UTC; SOCS=CAI; GPS=1}
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request body:
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request body:
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request body:
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [FINE] YoutubeExplode.HttpClient: Sending request: GET https://www.youtube.com/watch?v=i2mV0LApDTA&bpctr=9999999999&has_verified=1&hl=en
I/flutter (27480): [FINE] YoutubeExplode.HttpClient: Sending request: GET https://www.youtube.com/watch?v=i2mV0LApDTA&bpctr=9999999999&has_verified=1&hl=en
I/flutter (27480): [FINE] YoutubeExplode.HttpClient: Sending request: GET https://www.youtube.com/watch?v=i2mV0LApDTA&bpctr=9999999999&has_verified=1&hl=en
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request headers: {User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.18 Safari/537.36, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, Accept-Language: en-us,en;q=0.5, Sec-Fetch-Mode: navigate, Cookie: PREF=hl=en&tz=UTC; SOCS=CAI; GPS=1}
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request headers: {User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.18 Safari/537.36, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, Accept-Language: en-us,en;q=0.5, Sec-Fetch-Mode: navigate, Cookie: PREF=hl=en&tz=UTC; SOCS=CAI; GPS=1}
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request headers: {User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.18 Safari/537.36, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, Accept-Language: en-us,en;q=0.5, Sec-Fetch-Mode: navigate, Cookie: PREF=hl=en&tz=UTC; SOCS=CAI; GPS=1}
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request body:
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request body:
I/flutter (27480): [FINER] YoutubeExplode.HttpClient: Request body:
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)
I/flutter (27480): [WARNING] YoutubeExplode.Retry: Retrying after exception: VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): VideoUnavailableException: Video 'i2mV0LApDTA' is unavailable
I/flutter (27480): #0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169:9)

usilitel avatar Feb 04 '25 06:02 usilitel

@usilitel thanks for the logs, but unfortunately I still cannot reproduce it, on my end it seems to work fine:

  final yt = YoutubeExplode();
  final manifest = await yt.videos.streams.getManifest('i2mV0LApDTA');
  print(manifest);
  yt.close();
it prints the full manifest
format code  extension     resolution  quality       bitrate         size           codecs         info           
233          m3u8          audio only                ~47.65 Kbit/s   ~3.53 MB                      
139          mp4           audio only                49.28 Kbit/s    3.53 MB        mp4a.40.5      
249          webm          audio only                61.06 Kbit/s    3.90 MB        opus           
250          webm          audio only                78.32 Kbit/s    5.06 MB        opus           
234          m3u8          audio only                ~126.45 Kbit/s  ~9.38 MB                      
140          mp4           audio only                127.93 Kbit/s   9.38 MB        mp4a.40.2      
251          webm          audio only                151.79 Kbit/s   9.83 MB        opus           
278          webm          256x144     144p30        101.28 Kbit/s   6.43 MB        vp09.00.11.08  video only     
394          mp4           256x144     144p30        102.70 Kbit/s   4.53 MB        av01.0.00M.08  video only     
602          m3u8          256x144     144p15        ~133.05 Kbit/s  ~2.01 MB       vp09.00.10.08,mp4a.40.5  video only     
603          m3u8          256x144     144p30        ~158.09 Kbit/s  ~6.43 MB       vp09.00.11.08,mp4a.40.5  video only     
160          mp4           256x144     144p30        208.24 Kbit/s   5.41 MB        avc1.4D400C              video only     
269          m3u8          256x144     144p30        ~270.40 Kbit/s  ~5.41 MB       avc1.4D400C,mp4a.40.5    video only     
395          mp4           426x240     144p30        225.21 Kbit/s   8.27 MB        av01.0.00M.08            video only     
242          webm          426x240     144p30        243.35 Kbit/s   12.23 MB       vp09.00.20.08            video only     
604          m3u8          426x240     144p30        ~307.27 Kbit/s  ~12.23 MB      vp09.00.20.08,mp4a.40.5  video only     
133          mp4           426x240     144p30        484.31 Kbit/s   9.34 MB        avc1.4D4015              video only     
229          m3u8          426x240     144p30        ~560.27 Kbit/s  ~9.34 MB       avc1.4D4015,mp4a.40.5    video only     
396          mp4           640x360     360p30        418.88 Kbit/s   16.77 MB       av01.0.01M.08            video only     
243          webm          640x360     360p30        460.76 Kbit/s   21.33 MB       vp09.00.21.08            video only     
605          m3u8          640x360     360p30        ~618.12 Kbit/s  ~21.33 MB      vp09.00.21.08,mp4a.40.2  video only     
134          mp4           640x360     360p30        893.21 Kbit/s   17.31 MB       avc1.4D401E              video only     
230          m3u8          640x360     360p30        ~1.05 Mbit/s    ~17.31 MB      avc1.4D401E,mp4a.40.2    video only     
397          mp4           854x480     480p30        735.44 Kbit/s   28.70 MB       av01.0.04M.08            video only     
244          webm          854x480     480p30        766.04 Kbit/s   32.79 MB       vp09.00.30.08            video only     
606          m3u8          854x480     480p30        ~938.67 Kbit/s  ~32.79 MB      vp09.00.30.08,mp4a.40.2  video only     
135          mp4           854x480     480p30        1.29 Mbit/s     26.17 MB       avc1.4D401F              video only     
231          m3u8          854x480     480p30        ~1.48 Mbit/s    ~26.17 MB      avc1.4D401F,mp4a.40.2    video only     
398          mp4           1280x720    720p30        1.34 Mbit/s     53.55 MB       av01.0.05M.08            video only     
247          webm          1280x720    720p30        1.44 Mbit/s     54.39 MB       vp09.00.31.08            video only     
609          m3u8          1280x720    720p30        ~1.65 Mbit/s    ~54.39 MB      vp09.00.31.08,mp4a.40.2  video only     
136          mp4           1280x720    720p30        2.30 Mbit/s     47.40 MB       avc1.4D401F              video only     
232          m3u8          1280x720    720p30        ~2.55 Mbit/s    ~47.40 MB      avc1.4D401F,mp4a.40.2    video only     
248          webm          1920x1080   1080p30       2.46 Mbit/s     105.64 MB      vp09.00.40.08            video only     
614          m3u8          1920x1080   1080p30       ~2.72 Mbit/s    ~105.64 MB     vp09.00.40.08,mp4a.40.2  video only     
399          mp4           1920x1080   1080p30       3.15 Mbit/s     101.40 MB      av01.0.08M.08            video only     
137          mp4           1920x1080   1080p30       4.22 Mbit/s     167.30 MB      avc1.640028              video only     
270          m3u8          1920x1080   1080p30       ~4.56 Mbit/s    ~167.30 MB     avc1.640028,mp4a.40.2    video only     
616          m3u8          1920x1080   1080p30       ~5.57 Mbit/s    ~275.71 MB     vp09.00.40.08,mp4a.40.2  video only    

Does it work with yt-dlp? If so can you send the full output of the command?

Hexer10 avatar Feb 05 '25 11:02 Hexer10

@Hexer10 Right now, everything is working fine for me as well. This bug doesn't always appear. Last time, the video on YouTube was playing, but youtube_explode_dart threw a VideoUnavailableException error. I didn't try downloading it with yt-dlp. When the bug appears again, I'll report the results for yt-dlp.

However, there will be an issue with yt-dlp since the bug occurs on an Android phone, and I don't know how to run yt-dlp on the phone yet. I'll figure something out.

usilitel avatar Feb 06 '25 07:02 usilitel

I just got this exception myself:

VideoUnavailableException: Video 'E-yqx75OXE0' is unavailable
In most cases, this error indicates that the video doesn't exist, is private, or has been taken down.
If you can however open this video in your browser in incognito mode, it most likely means that YouTube changed something, which broke this library.
Please report this issue on GitHub in that case.
#0      WatchPage.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/pages/watch_page.dart:169)
<asynchronous suspension>
#1      retry (package:youtube_explode_dart/src/retry.dart:20)
<asynchronous suspension>
#2      VideoClient._getVideoFromWatchPage (package:youtube_explode_dart/src/videos/video_client.dart:38)
<asynchronous suspension>
#3      Downloader.download (package:meow_dart/src/downloader.dart:120)
<asynchronous suspension>
#4      DownloaderSpawner.spawnDownloader.<anonymous closure> (package:meow_dart/src/downloader_spawner.dart:99)
<asynchronous suspension>```

It only started happening several hundred video downloads into my playlist, and this error occured like 50 more times, with only a few breaks where videos were able to be downloaded again. Could it be rate limiting?

tytydraco avatar Feb 15 '25 02:02 tytydraco

It does seem to be a rate-limiting thing it seems. It only happens after rapid fire queries, and after that, even different videos that were not blocked cannot be queried. After waiting a day, the previous failed downloads are able to be downloaded again. A VPN did not circumvent the issue.

tytydraco avatar Feb 15 '25 22:02 tytydraco

Same problem!

secret3579 avatar Mar 02 '25 06:03 secret3579

I've made some changes for the the ios client in v2.4.0-dev.1 but I couldn't test it whether it helps or not; if someone is able to test it let me know if it helps in mitigating the errors or not

Hexer10 avatar Mar 05 '25 10:03 Hexer10

Add Tor circuit in your application .Which basically changes IP addresses every 10 minutes which will let you fetch the song without getting blocked at youtube end.

// Tor-enabled YoutubeExplode with circuit refresh class TorYoutubeExplode extends YoutubeExplode { final String torHost = '127.0.0.1'; final int torPort = 9050; // SOCKS5 proxy port final int controlPort = 9051; // Control port for circuit refresh late final http.Client _torHttpClient;

TorYoutubeExplode() : super() { _torHttpClient = _createTorHttpClient(); }

http.Client _createTorHttpClient() { final client = HttpClient(); client.findProxy = (uri) => 'SOCKS5 $torHost:$torPort'; client.connectionTimeout = const Duration(seconds: 30); // Tor is slow return IOClient(client); }

@OverRide http.Client get httpClient => _torHttpClient;

// Refresh Tor circuit to get a new IP Future refreshTorCircuit() async { try { print('Connecting to Tor control port at $torHost:$controlPort...'); final socket = await Socket.connect(torHost, controlPort); print('Connected to Tor control port successfully');

print('Sending AUTHENTICATE command...'); socket.write('AUTHENTICATE\r\n'); await socket.flush();

// Read response final authResponse = await socket.listen((data) { print('Authentication response: ${utf8.decode(data)}'); }).asFuture(); print('Authentication completed');

print('Requesting new Tor circuit...'); socket.write('SIGNAL NEWNYM\r\n'); await socket.flush();

// Read response final newNymResponse = await socket.listen((data) { print('New circuit response: ${utf8.decode(data)}'); }).asFuture(); print('New circuit requested');

// Get current IP address try { final response = await http.get(Uri.parse('https://api.ipify.org?format=json')); if (response.statusCode == 200) { final ipData = json.decode(response.body); print('New IP Address: ${ipData['ip']}'); } } catch (e) { print('Failed to get IP address: $e'); }

print('Closing Tor control connection...'); socket.write('QUIT\r\n'); await socket.flush(); await Future.delayed(const Duration(seconds: 3)); // Wait for new circuit await socket.close(); print('Tor circuit refresh completed successfully'); } catch (e) { print('Failed to refresh Tor circuit: $e'); print('Error details: ${e.toString()}'); } } }

and call this function at every song fetch. It is fast and reliable. Let me know if this works.

mitulgelani avatar Mar 09 '25 10:03 mitulgelani

  • duplicate of #271 ?

If you can however open this video in your browser in incognito mode, it most likely means that YouTube changed something, which broke this library.

Right now, everything is working fine for me as well. This bug doesn't always appear

It only started happening several hundred video downloads into my playlist

YouTube is blocking unofficial clients, but it only happens intermittently when not signed in -- and it fails more often when a public proxy is used. In some situations, when blocking occurs an HTTP 403 (forbidden) error will be returned. Sometimes this issue can be resolved by viewing the same content in a web browser, or another app. At the present time, several apps that employ the NewPipe or InnerTube library are more reliable. For diagnostic purposes, you could try OuterTune, Kreate, SimpMusic, Metrolist, FreeTube or GrayJay (which uses a custom plug-in).

Related issues: https://github.com/Hexer10/youtube_explode_dart/issues/341 / https://github.com/Hexer10/youtube_explode_dart/issues/343 / https://github.com/Hexer10/youtube_explode_dart/issues/352

xa4hf8 avatar Jul 09 '25 17:07 xa4hf8