From ac9eaf5c4fcaf6d41804dc67a17ccb77a99e1668 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 15 Aug 2020 22:00:07 +0200 Subject: Ignore some error when downloading --- extractors/common.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'extractors') diff --git a/extractors/common.py b/extractors/common.py index da3e59c..0287496 100644 --- a/extractors/common.py +++ b/extractors/common.py @@ -1,7 +1,7 @@ import os import re from pathlib import Path -from sh import youtube_dl +from sh import youtube_dl, ErrorReturnCode_1 from utils import read_file, write_file @@ -36,12 +36,16 @@ class Extractor(): write_file(cache_file, self.root + "," + self.__class__.__name__) def _yt_wrapper(self, url, output): - for line in youtube_dl( - url, audio_format="mp3", - add_metadata=True, - o=output + self.filename_template, - _iter=True): - print(line.strip()) + try: + for line in youtube_dl( + url, audio_format="mp3", + add_metadata=True, + o=output + self.filename_template, + ignore_errors=True, + _iter=True): + print(line.strip()) + except ErrorReturnCode_1: + pass def download_albums(self, output): for album in self._albums: -- cgit v1.2.1