timhutton / twitter-archive-parser

Python code to parse a Twitter archive and output in various ways

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: crashes on 404 error ("Failed to get user handle: <Response [404]>")

Bougakov opened this issue · comments

Parsing ./data/direct-messages.js...
1 users are unknown.
Download user data from Twitter (approx 2KB)? [y/n]y
Traceback (most recent call last):
  File "/Users/sanja/Downloads/twitter-2022-11-20-52795906fc4533f7d93a763b1a6193fc624fdc507a4c5ca6f932f329488c105f/parser.py", line 580, in <module>
    main()
  File "/Users/sanja/Downloads/twitter-2022-11-20-52795906fc4533f7d93a763b1a6193fc624fdc507a4c5ca6f932f329488c105f/parser.py", line 565, in main
    parse_direct_messages(data_folder, users, user_id_URL_template, output_dms_filename)
  File "/Users/sanja/Downloads/twitter-2022-11-20-52795906fc4533f7d93a763b1a6193fc624fdc507a4c5ca6f932f329488c105f/parser.py", line 476, in parse_direct_messages
    lookup_users(list(dm_user_ids), users)
  File "/Users/sanja/Downloads/twitter-2022-11-20-52795906fc4533f7d93a763b1a6193fc624fdc507a4c5ca6f932f329488c105f/parser.py", line 107, in lookup_users
    retrieved_users = get_twitter_users(session, bearer_token, guest_token, filtered_user_ids)
  File "/Users/sanja/Downloads/twitter-2022-11-20-52795906fc4533f7d93a763b1a6193fc624fdc507a4c5ca6f932f329488c105f/parser.py", line 83, in get_twitter_users
    raise Exception(f'Failed to get user handle: {response}')
Exception: Failed to get user handle: <Response [404]>

Thank you for reporting! Will make sure we are robust to this.

@Bougakov Try it now please, with the latest version. It should continue if the download fails. If it still prints an error message then please post it here.