Since you are new, let us show you how Trendy works.

Close-button

The number of times "sun" or "sunny" was mentioned per minute.

This trend is broken.

Music Tweets/min, MinutesCovered
Index exceeds matrix dimensions.
  • Created by: Semin Ibisevic
  • Last ran: about 1 year ago.
  • Auto-run in: about 1 year.
  • Created on: 09 May 2013

657

data points

Error

Description:

Using the code from Richard Kohar. See also: http://www.mathworks.com/matlabcentral/trendy/plots/1108

Recently Collected Data (last 5 of 657) Show All Data

Time Recorded (time2019) Data (data2019)
05 Jun 2013 22:00:52 NaN
05 Jun 2013 21:00:48 [84719.6073872164]
05 Jun 2013 20:00:52 [28300.0586168192]
05 Jun 2013 19:00:50 [28300.0586168192]
05 Jun 2013 18:00:56 [84600.4588748072]
% ------------------------------------------------------------
% I use the code of Richard Kohar to retrieve the number of times 'Sun' is mentioned on Twitter.
% ------------------------------------------------------------





% Code is based on the Scrapes Twitter to find "Mood of the World".

% Regular expression for pulling out dates/times
exp = '((31(?!\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\b|t)t?|Nov)(ember)?)))|((30|29)(?!\ Feb(ruary)?))|(29(?=\ Feb(ruary)?\ (((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8])\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\b|t)t?|Nov|Dec)(ember)?)\ ((1[6-9]|[2-9]\d)\d{2}) (([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9])):(([0-9])|([0-5][0-9]))[^[0-9]]';
urlHost = 'http://search.twitter.com/search.json';

% 1. Sun
search{1} = '?q="sun"+OR+"#sunny"&rpp=100&result_type=recent';
emotion{1} = 'sun';

disp('Music Tweets/min, MinutesCovered')
% I didn't realize "Trends" are scalars
% for loop=1:length(search)
loop = 1;
    url = [urlHost search{loop}];
    page = urlread(url);
    matches=regexp(page, exp, 'match');
    time1 = datenum(matches{1});

    url = [urlHost search{loop} '&page=15'];
    page = urlread(url);
    matches=regexp(page, exp, 'match');
    time2 = datenum(matches{end});

    seconds = (time1-time2)*24*60*60;
    tweetsPerMinute = (1400+length(matches))/(seconds / 60);

    disp([emotion{loop} num2str(tweetsPerMinute) ', ' num2str(seconds/60)])

% end

updatetrend(tweetsPerMinute);
Tags:

    Add Tags


    0 comments