mental
mental

Reputation: 1

Parse data with Java from a website

I want to parse some card prices from a site* so I can update the value of my collection automatically so I don't have to do it card by card

*http://www.starcitygames.com

For example from http://sales.starcitygames.com/category.php?t=a&cat=5243

I look at the page source and don't see prices anywhere. Any idea how the prices are stored and if there is a way to get them?

Thanks in advance

Upvotes: 0

Views: 333

Answers (1)

Beau Grantham
Beau Grantham

Reputation: 3456

This particular site uses images and CSS to display the prices (possibly to prevent exactly what you're trying to do).

If you dig into the source, you will see something like this:

<div class="oaqvOV">$</div>
<div class="xhzvwu tLRmnx2 oaqvOV">&nbsp;</div>
<div class="oaqvOV pkiHbu2 xhzvwu">&nbsp;</div>
<div class="oaqvOV tLRmnx2 xhzvwu">&nbsp;</div>
<div class="tLRmnx2 xhzvwu oaqvOV">&nbsp;</div>

If you continue digging into the CSS, you will find classes like these:

.oqcnoG {
  background-image:url(http://sales.starcitygames.com/price_icons.php?id=5yVRpSxt2fzNPjifOrIkBH6MJ8DcHamdiinhpzowGIk);
}

If you take a look at that image, you will find some numbers. These are what make up the prices being displayed.

You'll need parse based on the classes, which may or may not be random or change over time to prevent this activity.

Upvotes: 4

Related Questions