koenrh / delete-tweets

Delete tweets from your timeline.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mwoolweaver opened this issue · comments

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?

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

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.

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

Ubuntu 19.10

And both

Python 2.7.17rc1

Python 3.7.5

@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.

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