1

I am trying to retrieve this

http://www.vgreleases.com/ReleaseDates/Upcoming.aspx

It is a list of upcoming titles. I just want to retrieve the list. How would i go about doing this?

I am familiar with JSOUP. Just need a little help with this one.

I also want to provide a NEXT MONTH button to go and load the titles on the next page.

How would i go about beginning and doing this?

Or is it even possible?

EDIT:

The list has a pattern like this....

<div class="FP_Up_Item">


    <div class="FP_Up_Date">
<b><span style="color: rgb(25, 150, 0); font-weight: bold;">01 Sep 2011</span></b> <br>  <span style="color: rgb(163, 163, 163);">17 days left</span>
</div>

<div class="FP_Up_ImageWrap"><img src="http://m3.n4g.com/8/GameProfiles/814000/814166_1_cov_med.jpg"></div>
<div class="FP_Up_TextWrap" style="width: 300px;">
<a href="/PS3/ReleaseDate-814166.aspx" style="color: rgb(105, 34, 30);"><b>Child of Eden</b></a> <br><span style="font-weight: normal; color: rgb(163, 163, 163); font-size: 10pt;">(PS3)</span><br>

</div>

 <div class="FP_Up_Score"><a href="/PS3/ReleaseDate-814166.aspx?ShowReviews=1">8.2</a></div>

</div>
Cœur
  • 37,241
  • 25
  • 195
  • 267
coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118

2 Answers2

2

You can get the div for each game using the class. As for the next button, you can see if the reference contains "/ReleaseDates/".

// Get all the game elements
Elements games = doc.select("div.FP_Up_TextWrap");

// Iterator over those elements
ListIterator<Element> postIt = games.listIterator();

while (postIt.hasNext()) {
    System.out.println(postIt.next().text());

}

// Get the "Next Month" element
Element next = doc.select("a[href*=/ReleaseDates/]").last();

System.out.println(next.attr("href"));

To add to a list

// Get all the game elements
Elements games = doc.select("div.FP_Up_TextWrap");

// Create new ArrayList
ArrayList<String> gameList = new ArrayList<String>();

// Iterator over those elements
ListIterator<Element> postIt = games.listIterator();

while (postIt.hasNext()) {
    // Add the game text to the ArrayList
    gameList.add(postIt.next().text());
}
Aaron Foltz
  • 138
  • 2
  • 9
0

You could use SAXParser to parse that response. Extend the DefaultHandler class to do this.

Ron
  • 24,175
  • 8
  • 56
  • 97