mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-24 10:50:11 +00:00
fix channel extraction to catch all alerts, #312
This commit is contained in:
parent
3c92de8e24
commit
a6dd927860
@ -73,13 +73,14 @@ class ChannelScraper:
|
|||||||
|
|
||||||
def _is_deactivated(self):
|
def _is_deactivated(self):
|
||||||
"""check if channel is deactivated"""
|
"""check if channel is deactivated"""
|
||||||
alert_text = "This channel does not exist."
|
|
||||||
alerts = self.yt_json.get("alerts")
|
alerts = self.yt_json.get("alerts")
|
||||||
if alerts and alert_text in str(alerts):
|
if not alerts:
|
||||||
print(f"{self.channel_id}: {alert_text}")
|
return False
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
for alert in alerts:
|
||||||
|
alert_text = alert["alertRenderer"]["text"]["simpleText"]
|
||||||
|
print(f"{self.channel_id}: failed to extract, {alert_text}")
|
||||||
|
return True
|
||||||
|
|
||||||
def _parse_channel_main(self):
|
def _parse_channel_main(self):
|
||||||
"""extract maintab values from scraped channel json data"""
|
"""extract maintab values from scraped channel json data"""
|
||||||
@ -226,8 +227,8 @@ class YoutubeChannel(YouTubeItem):
|
|||||||
|
|
||||||
self.json_data.update(
|
self.json_data.update(
|
||||||
{
|
{
|
||||||
"channel_subs": content["channel_follower_count"],
|
"channel_subs": content.get("channel_follower_count", 0),
|
||||||
"channel_description": content["description"],
|
"channel_description": content.get("description", False),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user