Problem 1949. Get top 5 Cody Player Emails Automatically

Yes, this is a little scary and also entirely possible to do in MATLAB, so let's do it!

Looking at the list of the players automatically sorts them in order according to rank. For times sake, let's say we only want to get the emails from the first 5 people. This is relatively easy to do by hand, just click on the persons name, click on "View Profile Information" and you have the email but if you wanted to do say the first 1,000 people instead, that would be not very fun to do by hand.

For this program, let's say we want the top 5 profiles that give a "real" email address (not a contact form) to be in a cell array. This means that if one of the top 5 people have removed their email address, your returned cell array will have less than 5 emails in it.

If you are not sure where to start, check out the urlread command, it allows you to put the web page source code into a string. From there, you are able to parse through that to get the URLs for the top 5 players web profile. From there, look for a "mailto:" and if it is there, the email address is immediately following it. If the string "mailto:" does not exist, there is no email address on that webpage. Put the emails in a cell array when you find them and you are good to go!

As an example, I have poorly written MATLAB code that works in the test case since I want the test case to always be accurate. 98% of the execution time is spent reading the webpages, and at least on my computer, that takes quite a while to do (about 2.5 seconds per profile page).

I am definitely not collecting emails for anything, and you should not either! This is designed solely as a learning example and should in no way be used for anything unethical. All information obtained here is easily obtained by anyone in the world who knows how to program.

If this scares you and you want to remove your email address from your profile, it's easy. All you have to do is click "My Community Profile" (underneath the search bar at very top of screen) and then edit your preferences to not display your email address.

Solution Stats

40.63% Correct | 59.38% Incorrect
Last Solution submitted on Mar 29, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers13

Suggested Problems

More from this Author3

Community Treasure Hunt

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

Start Hunting!