How to extract tweets given an ID
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Steven Lord
on 22 Aug 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.
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!