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);
waited = true;
if let structs::Error::YoutubeDL(ref err) = err {
if err.output.contains("429")
|| err
.output
.to_lowercase()
.contains("too many request")
let output = err.output.to_lowercase();
if output.contains("429")
|| output.contains("too many request")
|| output.contains("technical difficult")
{
sleep(Duration::from_secs(i * 60 * 60)).await;
i += 1;

View File

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