Handle "technical difficulties"

This commit is contained in:
blank X 2021-06-25 16:43:05 +07:00
parent 2524833326
commit e6b44d8dbf
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 8 additions and 7 deletions

View File

@ -195,11 +195,10 @@ async fn async_main() {
eprintln!("Failed to get video data: {:?}", err); eprintln!("Failed to get video data: {:?}", err);
waited = true; waited = true;
if let structs::Error::YoutubeDL(ref err) = err { if let structs::Error::YoutubeDL(ref err) = err {
if err.output.contains("429") let output = err.output.to_lowercase();
|| err if output.contains("429")
.output || output.contains("too many request")
.to_lowercase() || output.contains("technical difficult")
.contains("too many request")
{ {
sleep(Duration::from_secs(i * 60 * 60)).await; sleep(Duration::from_secs(i * 60 * 60)).await;
i += 1; i += 1;

View File

@ -170,8 +170,10 @@ pub async fn get_video_retry(
Err(err) => { Err(err) => {
eprintln!("Failed to get video data: {:?}", err); eprintln!("Failed to get video data: {:?}", err);
if let Error::YoutubeDL(ref err) = err { if let Error::YoutubeDL(ref err) = err {
if err.output.contains("429") let output = err.output.to_lowercase();
|| err.output.to_lowercase().contains("too many requests") if output.contains("429")
|| output.contains("too many requests")
|| output.contains("technical difficult")
{ {
sleep(Duration::from_secs(i * 60 * 60)).await; sleep(Duration::from_secs(i * 60 * 60)).await;
continue; continue;