JustAnotherArchivist / snscrape

A social networking service scraper in Python
GNU General Public License v3.0
4.39k stars 702 forks source link

replyCount, retweetCount error in --format #196

Closed AshwinChetri closed 3 years ago

AshwinChetri commented 3 years ago

I would like to extract replyCount & retweetCount. It seems there is an error while trying to export them. I would need help in exporting them, should I use someother identifier?

I am running below script in Google colab (Python 3.6.9)

snscrape --format '{date}~{url!r}~{content!r}~{username}~{replyCount}~{retweetCount}' --max-results 100 --since 2019-09-01 twitter-search "testuntil:2020-02-18" > test.txt

Error Message:

2021-02-21 13:59:07.492  CRITICAL  snscrape.cli  Dumped stack and locals to /tmp/snscrape_locals_1weumcqi
Traceback (most recent call last):
  File "/usr/local/bin/snscrape", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/snscrape/cli.py", line 235, in main
    print(args.format.format(**item._asdict()))
KeyError: 'retweetCount'
JustAnotherArchivist commented 3 years ago

You need the current development version of snscrape for those fields. The last release (0.3.4) only has a few very basic metadata fields.

Duplicate of #158