fail open on ryd error

This commit is contained in:
simon 2022-08-18 18:45:46 +07:00
parent 115db944c8
commit 0e7e0a0560
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -320,15 +320,16 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
def _get_ryd_stats(self):
"""get optional stats from"""
# pylint: disable=broad-except
print(f"{self.youtube_id}: get ryd stats")
result = ryd_client.get(self.youtube_id)
except requests.exceptions.ConnectionError:
print(f"{self.youtube_id}: failed to query ryd api, skipping")
return False
except Exception as err:
print(f"{self.youtube_id}: failed to query ryd api {err}")
if result["status"] == 404:
return False
dislikes = {
"dislike_count": result.get("dislikes", 0),
@ -336,8 +337,6 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
return True
def _get_sponsorblock(self):
"""get optional sponsorblock timestamps from"""
sponsorblock = SponsorBlock().get_timestamps(self.youtube_id)