Catch exception on bad nitter page

This commit is contained in:
JCF 2024-02-12 12:17:03 +00:00
parent 4246cca0a4
commit 53d7dcdc93

View File

@ -539,9 +539,9 @@ def build_config(args):
options = {
'nitter_instances': [
'n.opnxng.com', # added 10/11/2023
'nitter.ktachibana.party', # added 01/11/2023
'nitter.mint.lgbt', # added 09/02/2024
'nitter.1d4.us', # added 09/02/2024
# 'nitter.ktachibana.party', # added 01/11/2023
# 'nitter.x86-64-unknown-linux-gnu.zip', # down 09/02/2024
# 'nitter.tinfoil-hat.net', # down 09/02/2024
# 'nitter.eu.projectsegfau.lt', # down 14/11/2023
@ -687,8 +687,13 @@ def get_timeline(session, nitter_url):
tl = soup.find('div', class_='timeline')
# Get the list of direct children of timeline
list = tl.find_all('div', recursive=False)
try:
list = tl.find_all('div', recursive=False)
except AttributeError:
logging.fatal('The Nitter page ' + url + ' does not include the expected content')
logging.fatal(twit_account_page.text)
shutdown(-1)
timeline = []
for item in list:
classes = item['class']