Login Search

Excel based tutorial for web scraping

Last Post
#211

Default

Quote Originally Posted by b_rad_1983 View Post
In the time it took you to do that, how long would it take to accomplish it in php?
Oh yea, if you know regular expressions you can do anything. For example, this is how easy it is to get the html of a website...

Code: [View]
$url = 'http://scores.espn.go.com/mlb/scoreboard?date='.$espnDate;

//get the contents of the page
$handle = file_get_contents($url);
$str     = htmlentities($handle);
Then with regular expressions you can just pick it apart. For instance this is how easy it is to get every espn game id for that day

Code: [View]
$pattern = '/(\d*)-gamebox/';
preg_match_all($pattern,$str,$gameIDs);
Now in my $gameIDs variable, I have an array with every gameID for that day, so I can then loop through those and go to the boxscores to extract the player data and in the database it would all be tied to that game id.

Just something to think about if you ever wanted to expand.
#213

Default

Quote Originally Posted by oilcountry99 View Post
Excuse my ignorance here and complete lack of knowledge of PHP and what it is and how it works but I have a question. What would one use to create the code and where is the output displayed, what is the format? In excel for example it uses vba, the code is written in the program and output on the sheets.
PHP is what sites like Amazon or Facebook is written in. The most common web language in the world. But, in order to process the code you have to install Apache, PHP, and most likely a database like MySql. Or purchase a hosting service that has all that available. I use Xampp for development purposes, apachefriends.org. Definitely has a long learning curve to it though. I've been doing it for 5 years now so it's a bit easier, but it was brutal at first. Especially if you don't come from a computer science background like me.
#214

Default

Quote Originally Posted by akphidelt View Post
PHP is what sites like Amazon or Facebook is written in. The most common web language in the world. But, in order to process the code you have to install Apache, PHP, and most likely a database like MySql. Or purchase a hosting service that has all that available. I use Xampp for development purposes, apachefriends.org. Definitely has a long learning curve to it though. I've been doing it for 5 years now so it's a bit easier, but it was brutal at first. Especially if you don't come from a computer science background like me.

I have zero computer science background and just got into vba recently....it's extremely frustrating and very rewarding at the same time.

Thanks for your insight
#216

Default

b_rad...

Try this out. Had some time after work. This took about 20-30 minutes. Was able to log every pick. It will take a little bit longer to make this dynamic where it goes in and updates the pending results every time. The only thing I can do right now is clear the database and rerun the code to pick up the new results. I'll work on getting it where you can click a button and update the pending results. This logged over 5000 bets.

http://akptracker.com/index.php?c=insiders
#219

Default

I'd add a column in sheet a with a formula extracting D. Duffy, which you already know how to do. Then I'd at a column with a formula in the other sheet breaking Danny Duffy in to D. Duffy and use vlookup or Index/Match depending on where you add the columns. The only problem with this is if there are two or players with the same first initial/last name.
#220

Default

I was thinking on not adding any columns, rather to text split from right to the first space in a formula, combined with vlookup. Object is to take the probable pitcher for the game, match it with the pitcher data that you showed me how to do, then grab the whip, and this formula will be in the whip column
#221

Default

Quote Originally Posted by b_rad_1983 View Post
I was thinking on not adding any columns, rather to text split from right to the first space in a formula, combined with vlookup. Object is to take the probable pitcher for the game, match it with the pitcher data that you showed me how to do, then grab the whip, and this formula will be in the whip column
That's going to be pretty difficult. Have you figured it out yet?
#224

Default

Quote Originally Posted by b_rad_1983 View Post
I have not had time to try, i did something similar on my nhl project using search function. But I have not combined anything with vlookup yet
I don't think vlookup would work in this case. Not sure what would without adding new columns. You can always add a column in the VBA that creates the first initial/last name identifier then you can use vlookup in the probables page. But once again that would cause problems if there are more than 1 match. That's were databases are nice because you can attack a unique identifier (uid) to each player and it doesn't matter what their names are.