Problem 1949. Get top 5 Cody Player Emails Automatically

Solution 336377

Submitted on 21 Oct 2013 by Alfonso Nieto-Castanon
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% % My code is below, it's used to generate the expected result. %Read in the player page playerPage=urlread(''); %Find where the web address for each profile starts startIdx=strfind(playerPage,'<div class="grid_53 push_3">')+104; %Initialize output array emails={}; %Get top 5 only for i=1:5 % Get the profile page link tempStr=playerPage(startIdx(i):startIdx(i)+100); quoteIdx=strfind(tempStr,'"')-1; profilePageLink=['' tempStr(1:quoteIdx(1))]; profilePage=urlread(profilePageLink); % Try and find mailto link tStartIdx=strfind(profilePage,'mailto'); %If you could find it if ~isempty(tStartIdx) % Get the email tEndIdx=strfind(profilePage(tStartIdx:tStartIdx+100),'"')+tStartIdx; % Add it to our cell array emails{length(emails)+1}=profilePage(tStartIdx+7:tEndIdx-2); end end tic yourResponse=getCodyEmails() timeElapsed=toc assert(isequal(yourResponse,emails)) assert(isequal(1,timeElapsed>3))

yourResponse = '' '' [1x23 char] [1x30 char] timeElapsed = 9.9804

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!