1

I want to download a dataset (SemEval 2016/2017) as described in

http://alt.qcri.org/semeval2017/task4/index.php?id=data-and-tools

which in turn reminds to

https://github.com/seirasto/twitter_download

the last link provides instructions on how to run the scripts to download the dataset.

I use Ubuntu, and from the command prompt I run

twitter

as described in the readme file. It opens the web browser from which I log in with my twitter username and password. I obtain a PIN code and I enter it into the prompt generated by the script.

Then, I try to download the dataset with the command

python3 download_tweets_api.py --dist=tweeti-a.dist.tsv --output=downloaded.tsv

but I get

fp@fp-X58LE:~/twitter_download-master$ python3 download_tweets_api.py --dist=tweeti-a.dist.tsv --output=downloaded.tsv
Hi there! We're gonna get you all set up to use Semeval sentiment analysis.
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/twitter/api.py", line 341, in _handle_response
    handle = urllib_request.urlopen(req, **kwargs)
  File "/usr/lib/python3.4/urllib/request.py", line 161, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.4/urllib/request.py", line 469, in open
    response = meth(req, response)
  File "/usr/lib/python3.4/urllib/request.py", line 579, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.4/urllib/request.py", line 507, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 441, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 587, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Authorization Required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "download_tweets_api.py", line 21, in <module>
    oauth_dance("Semeval sentiment analysis", CONSUMER_KEY, CONSUMER_SECRET, MY_TWITTER_CREDS)
  File "/usr/local/lib/python3.4/dist-packages/twitter/oauth_dance.py", line 93, in oauth_dance
    twitter.oauth.request_token(oauth_callback="oob"))
  File "/usr/local/lib/python3.4/dist-packages/twitter/api.py", line 334, in __call__
    return self._handle_response(req, uri, arg_data, _timeout)
  File "/usr/local/lib/python3.4/dist-packages/twitter/api.py", line 367, in _handle_response
    raise TwitterHTTPError(e, uri, self.format, arg_data)
twitter.api.TwitterHTTPError: Twitter sent status 401 for URL: oauth/request_token using parameters: (oauth_callback=oob&oauth_consumer_key=JEdRRoDsfwzCtupkir4ivQ&oauth_nonce=6666274229238613502&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1592954865&oauth_version=1.0&oauth_signature=T8xiOX4HMOLQcertNeMC1vlnoHM%3D)
details: {"errors":[{"code":32,"message":"Could not authenticate you."}]}

I disinstalled and reinstalled python and twitter, I can't figure out how to proceed at the moment.

Before running the script, following groups.google.com/forum/#!topic/semevaltweet/4e45k1QkHk4 I first copied the training data ids file twitter-2016train-A.txt (downloaded from the data & tools page alt.qcri.org/semeval2017/task4/index.php?id=data-and-tools) in the same directory of the scripts and I renamed it as tweeti-a.dist.tsv.

FrancescoVe
  • 1,060
  • 1
  • 7
  • 12

0 Answers0