koenrh / delete-tweets

Delete tweets from your timeline.
ISC License
792 stars 107 forks source link

json.decoder.JSONDecodeError: Extra data: line 1 column 12 (char 11) #69

Closed mwoolweaver closed 4 years ago

mwoolweaver commented 4 years ago
Traceback (most recent call last):
  File "/usr/local/bin/delete-tweets", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/deletetweets/__main__.py", line 53, in main
    deletetweets.delete(args.file, args.date, filters, args.spare_ids, args.min_likes, args.min_retweets, args.dry_run)
  File "/usr/local/lib/python3.7/dist-packages/deletetweets/deletetweets.py", line 72, in delete
    tweets = json.loads(tweetjs_file.read()[25:])
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 12 (char 11)

Json that is being used https://sfo2.digitaloceanspaces.com/mbcdn/psty/d3a_tweet-part2.js

Not why I’m getting the error that’s being shown above?

koenrh commented 4 years ago

The data file looks alright. Are you on the latest version? pip install -U delete-tweets

mwoolweaver commented 4 years ago
mdwoolweaver@sky-hole:~$ pip install -U delete-tweets
Requirement already up-to-date: delete-tweets in /usr/local/lib/python3.7/dist-packages (1.0.4)
mdwoolweaver@sky-hole:~$ delete-tweets --until 2018-01-01 tweet.js
Traceback (most recent call last):
  File "/usr/local/bin/delete-tweets", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/deletetweets/__main__.py", line 53, in main
    deletetweets.delete(args.file, args.until_date, filters, args.spare_ids, args.min_likes, args.min_retweets, args.dry_run)
  File "/usr/local/lib/python3.7/dist-packages/deletetweets/deletetweets.py", line 70, in delete
    tweets = json.loads(tweetjs_file.read()[25:])
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 12 (char 11)

I use wget https://sfo2.digitaloceanspaces.com/mbcdn/psty/d3a_tweet-part2.js to download then use mv d3a_tweet-part2.js tweet.js to rename it. Not sure why it’s not working.

koenrh commented 4 years ago

@mwoolweaver Haven't been able to reproduce, but I'll have a closer look tomorrow. What OS are you using?

mwoolweaver commented 4 years ago

Ubuntu 19.10

And both

Python 2.7.17rc1

Python 3.7.5

koenrh commented 4 years ago

@mwoolweaver I'm sorry, I lost the failing JSON file, could you send it to koen@rwhrst.nl? Thanks.

Now that I reread the error it looks like it is somehow reading a Python dict instead of JSON file.

mwoolweaver commented 4 years ago

Done!

koenrh commented 4 years ago

This should have been fixed with new data format Twitter uses. Please reopen if the issue persists with this new format.