Comments (16)
I get
Error 404 -> Video 1,2,4
Error 410 -> Video 3,5,6,7
Looks like some of the streams were deleted for whatever reason but the references still remain in the get_video_info
API.
The only thing the videos seem to have in common is that they all have very few available qualities - either 144p and 240p or only 360p.
from youtubeexplode.
I really don't want to add try/catch blocks to the HTTP requests... Maybe we can just add a IHttpService.PingAsync(string url)
and use it to see if the stream is alive?
from youtubeexplode.
Actually, instead of using response.EnsureSuccessStatusCode();
we can maually check if response.IsSuccessStatusCode
and then act accordingly. I'd say just drop the stream (since it's not available anymore), but I haven't decided on what's the best implementation of this.
from youtubeexplode.
You mean like returning null
from those methods if the code doesn't signify success? The problem is then IHttpService
cannot guarantee all its implementation will follow that guideline. We can also just return HttpResponse
to callers but I feel like it's an overkill, considering this is (so far) the only place where this would be needed. I think it's fine that they throw exceptions and then we can use bool CheckSuccessAsync(string url)
only when we actually expect some url not to work (but still able to continue execution).
from youtubeexplode.
I do belive we can't get arround a (specific) try-catch, since
- As you said, we don't need to implement magic return values or out parameters
- Thats the purpose of those exceptions, to handle exceptions
from youtubeexplode.
Where exactly and what exception are you suggesting to catch?
from youtubeexplode.
Oh, I was wrong. I thought the http status code is in the exception data included.
When do you mean we should execute bool CheckSuccessAsync(string url)
? Befor every time we execute IHttpService.GetHeadersAsync
?
from youtubeexplode.
No, just for the streams I think
from youtubeexplode.
That's what I mean, currently it's every time ^^ But now I see what you are going for. I think you are talking about the mixed stream for loop in it's whole.
Hm, could be possible to do so
from youtubeexplode.
Oh yeah, I meant inside that loop instead of inside GetHeadersAsync or GetContentLengthAsync
from youtubeexplode.
But I'm still not sure about that exception design. I think there are many more error sources on some videos out there, we never can cover all posibilities. But when an error occured and from the GetVideoInfoAsync(id)
-method just comes a HttpRequestException
for example, I as library user would have no idea what to do to fix it. I think there should be at least a hint or something that's saying in which part of processing an error occured.
from youtubeexplode.
The thing is, if they are not using the default HttpService
they might have a different exception and then YoutubeClient
won't be able to handle it. :/
from youtubeexplode.
For example, if someone implements WebClientHttpService : IHttpService
that uses WebClient
instead of HttpClient
, which would then throw WebException
instead of HttpRequestException
from youtubeexplode.
Wouldn't it become an inner exception anyways?
from youtubeexplode.
Hmm. I meant that doing this:
try
{
long contentLength = await GetContentLengthAsync(url).ConfigureAwait(false);
}
catch (HttpRequestException)
{
}
...isn't really safe because there's no guarantee the supplied _httpService
will actually throw that exact exception on failure.
from youtubeexplode.
Ok on the second thought, sending CheckSuccessAsync
on every stream is probably a bad idea. It's going to significantly increase the time it takes to do GetVideoInfoAsync
...
from youtubeexplode.
Related Issues (20)
- Cannot get stream manifest of a video that is still being processed HOT 8
- Search feature crashes on mobile devices HOT 1
- Audio files are downloaded as WebM, Mp3 does not work HOT 3
- Using a live video URL throws an exception
- 403 (Forbidden) HOT 1
- Occasionally streams just dies HOT 13
- Streams are sometimes unstable
- Exception "Could not extract video upload date" with specific video
- GetVideosAsync does not return all videos of a playlist
- GetManifestAsync silent crash on Android HOT 9
- YoutubeExplode failed to fetch video HOT 1
- Closed captions that erroneously contain valid SRT segments within them break when processing with FFmpeg HOT 1
- Closed captions that contain invalid offsets and/or durations break when processing with FFmpeg
- Some streams can return 404 HOT 4
- Getting `System.Net.CookieException` on some requests HOT 6
- Invalid Youtube Video ID or URL error
- Searching fails when encountering pay-to-watch videos HOT 4
- Video downloads, but only audio, no video HOT 30
- Download private video by passing list of cookies, bit got 401
- 500 error when calling GetManifestAsync HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youtubeexplode.