Problem 1949. Get top 5 Cody Player Emails Automatically

Solution 748392

Submitted on 28 Sep 2015 by LY Cao
  • Size: 43
  • This is the leading solution.
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 = '' '' 'jmsainthillier@ch…' 'james.sambrook@na…' timeElapsed = 11.2844

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!