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 = { options = {
'nitter_instances': [ 'nitter_instances': [
'n.opnxng.com', # added 10/11/2023 'n.opnxng.com', # added 10/11/2023
'nitter.ktachibana.party', # added 01/11/2023
'nitter.mint.lgbt', # added 09/02/2024 'nitter.mint.lgbt', # added 09/02/2024
'nitter.1d4.us', # 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.x86-64-unknown-linux-gnu.zip', # down 09/02/2024
# 'nitter.tinfoil-hat.net', # down 09/02/2024 # 'nitter.tinfoil-hat.net', # down 09/02/2024
# 'nitter.eu.projectsegfau.lt', # down 14/11/2023 # 'nitter.eu.projectsegfau.lt', # down 14/11/2023
@ -687,7 +687,12 @@ def get_timeline(session, nitter_url):
tl = soup.find('div', class_='timeline') tl = soup.find('div', class_='timeline')
# Get the list of direct children of 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 = [] timeline = []
for item in list: for item in list: