How to extract tweets given an ID

3 visualizaciones (últimos 30 días)
Saugata Bose
Saugata Bose el 22 de Ag. de 2019
Comentada: Saugata Bose el 22 de Ag. de 2019
Hi
I am currently working on a project which demands analysing tweet data. For this, I have dopwnloaded a dataset which supposeldy containing the tweets as well as the category assigned against each tweet. However, after downloading the dataset I found it conatins some ID's and the assigned category. I have attached a snapshot of the dataset following:
Until now, I have tried this following sample code:
baseurl = 'https://api.twitter.com/1.1/statuses/show.json';
parameters.count = 1;
d = getdata(c,baseurl,parameters,'id','567824878201511000');
which shows error after execution. The error is following:
Error using char
Conversion to char from struct is not possible.
Error in twitter/getdata (line 73)
requestParams.(char(varargin{i})) = varargin{i+1};
Error in tweetRetreat (line 60)
d = getdata(c,baseurl,parameters,'id','567824878201511000');
I am pretty doubtdul how to extract tweets against each number from the dataset after creating the twitter credentials. Does anyone of you advice me in this regard?
thanks,
  2 comentarios
Guillaume
Guillaume el 22 de Ag. de 2019
which shows error after execution
And the full text of the error is...
Saugata Bose
Saugata Bose el 22 de Ag. de 2019
@Guillaume: I have added the error in the editeed question. The error is:
Error using char
Conversion to char from struct is not possible.
Error in twitter/getdata (line 73)
requestParams.(char(varargin{i})) = varargin{i+1};
Error in tweetRetreat (line 60)
d = getdata(c,baseurl,parameters,'id','567824878201511000');

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 22 de Ag. de 2019
Looking at the definition of the getdata method for twitter objects I suspect you want to either specify a number for the 'id' query parameter or query using the 'id_str' parameter. If you look at the struct array containing user data in the "Retrieve Twitter Data Using Name-Value Arguments" example on that page, it lists the account identifier in two ways.
FYI, this post on Loren Shure's blog may be of interest to you, as it deals with using Text Analytics Toolbox to analyze Twitter data retrieved using Datafeed Toolbox. Perhaps it could suggest tools and/or techniques for your analysis.
  1 comentario
Saugata Bose
Saugata Bose el 22 de Ag. de 2019
@Steven: Thanks for pointing me the necessary section. But after implementing the following code, it is showing 'StatusLine: 'HTTP/1.1 404 Not Found'. Does this mean that the tweet is no longer exist?? Besides, I must thank you to show me another Loren Shure's treasure. It will surely help me, I believe.
baseurl = 'https://api.twitter.com/1.1/statuses/show.json';
parameters.count = 1;
d = getdata(c,baseurl,'count',1,'id_str','562736780487974914')

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by