Jump to content
Unfortunately we had to take download section back offline temporarily. We should have it working normally soon.

Game Information Scraping (MobySharp)


1 Screenshot

About This File

Recently I had the need to obtain tons of data (as I am creating my own video gaming frontend (no, it's not for new systems; it is for old computers to play DOS games on.)) but there seemed to be a lack of tools out there for us software developers to use. So, my solution was to just simply make my own damned scraper that obtains detailed information from MobyGames. So, here I am after a day and a half of creating this scraper solution and am sharing it with the community in the hopes that I may save some other developer out there the headache and torture of doing this themselves.

The only functionality that I left out of the scraper is the obtaining of images (as most of MobyGames images are sub-par at best anyhow) and all I care about is the detailed data and don't want to waste any of their bandwidth obtaining said images.

The Dynamic Link Library

Using the library is fairly simple and a straight forward process. What I usually do is declare a global List<MobyGamesSearchResult> that is populated later on in the code. The reason that I declare a global is so that I can easily obtain the name of the game, and the MobyGames.com URL for the application URL (later on in the code examples it will become clearer what I mean.)

Setting up your methods

using MobySharp;

using MobySharp.Methods;

public partial class Form1 : Form

{

List<MobyGamesSearchResult> _gameList = new List<MobyGamesSearchResult>();

.....

Now that you have declared all of your variables that you will be using throughout the application we can safely populate our results list by calling a search function.

_gameList = new MobyScraper().SearchMoby(searchString);

if (_gameList != null)

foreach (var results in _gameList)

{

listBox1.Items.Add(results.Name);

}

Where searchString is equal to the name of the game you are looking for (ie DOOM II). You will notice that I also trap a null search result in the code above; as there is currently no method implemented of converting a null search (ie no games found.)

So, now that we have our _gameList populated and have listed all of the search names into a nice tidy listbox we can continue our code as seen whenever the user changes the listbox1 index.

foreach (var result in _gameList)

{

if (result.Name == (string)listBox1.SelectedItem)

{

var entry = new MobyScraper().GameInformation(result.Url);

labelName.Text = (string)listBox1.SelectedItem;

labelPublisher.Text = entry.Publisher;

labelReleaseDate.Text = entry.ReleaseDate;

labelDeveloper.Text = entry.Developer;

labelPlatform.Text = entry.Platform;

labelGenre.Text = entry.Genre;

labelPerspective.Text = entry.Perspective;

richTextBox1.Text = entry.Description;

richTextBox2.Text = entry.AlternateTitles;

return;

}

}

So, as you can see by the code above we first get a search list of all available titles; and an URL is assigned to each title. After we have made a game selection we cross reference the title name against the selected game and if a match is found we extract the URL and then create a new GameInformation object which will contain all of the data on said game.

The Example Application Showing Data

Posted Image

Anyhow, I hope some of my fellow third party developers get some use out of this; I have attached a sample application as well as the stand alone DLL file in this post.


User Feedback

Recommended Comments

There are no comments to display.

×
×
  • Create New...