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

Close-button

Number of Followers for MATLAB on Twitter

This trend is disabled.

Error using updatetrend (line 7)
The input must be a number or vector

This trend is disabled and will not collect data until re-enabled.

  • Created by: Toshiaki Takeuchi
  • Last ran: over 2 years ago.
  • Auto-run in: about 2 years.
  • Created on: 29 Jan 2012

159

data points

Disabled

Description:

Count the number of followers for MATLAB on Twitter. This trend uses the code from the Number of Followers for Matthew Simoneau (matthewsim) on Twitter trend.

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

Time Recorded (time1304) Data (data1304)
16 Jul 2012 06:10:54 NaN
15 Jul 2012 06:12:56 NaN
14 Jul 2012 06:12:56 NaN
13 Jul 2012 06:12:40 NaN
12 Jul 2012 06:12:56 NaN
% This trend uses the code from the "Number of Followers for 
% Matthew Simoneau (matthewsim) on Twitter" trend. 
% http://www.mathworks.com/matlabcentral/trendy/trends/1291

% Initialize the HTML parser, which happens to ship with MATLAB.
htmlConfiguration = org.cyberneko.html.HTMLConfiguration();
parser = org.apache.xerces.parsers.DOMParser(htmlConfiguration);

% Keep trying until we get an answer.
followers = [];
for tries = 1:10
    % Dowload and parse the page.
    parser.parse('http://twitter.com/matlab');
    
    % Scrape the number out of the parsed page.
    spans = parser.getDocument.getElementsByTagName('SPAN');
    for iSpans = 1:spans.getLength()
        span = spans.item(iSpans-1);
        id = char(span.getAttribute('id'));
        if strcmp(id,'follower_count')
            followers = str2double(char(span.getTextContent()));
        end
    end
    
    % How did we do?
    if isempty(followers)
        % Probably the page didn't download correctly. Wait and try again.
        pause(1)
    else
        % We're done!
        break
    end
end

% Return the result.
updatetrend(followers);
Tags:

Add Tags


0 comments