Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't find an amazon element with jsoup (Java) because I have little knowledge with web development
    text
    copied!<p>I'm currently trying to scrape amazon for a bunch of data. I'm using jsoup to help me do this, and everything has gone pretty smoothly, but for some reason I can't figure out how to pull the current number of sellers selling new products.</p> <p>Here's an example of the url I'm scraping : <a href="http://rads.stackoverflow.com/amzn/click/B006L7KIWG" rel="nofollow">http://www.amazon.com/dp/B006L7KIWG</a></p> <p>I want to extract "39&nbsp;new" from the following below:</p> <pre><code>&lt;div id="secondaryUsedAndNew" class="mbcOlp"&gt; &lt;div class="mbcOlpLink"&gt; &lt;a class="buyAction" href="/gp/offer-listing/B006L7KIWG/ref=dp_olp_new_mbc?ie=UTF8&amp;condition=new"&gt; 39&amp;nbsp;new &lt;/a&gt; &amp;nbsp;from&amp;nbsp; &lt;span class="price"&gt;$60.00&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>This project is the first time I've used jsoup, so the coding may be a bit iffy, but here are some of the things I have tried:</p> <pre><code> String asinPage = "http://www.amazon.com/dp/" + getAsin(); try { Document document = Jsoup.connect(asinPage).timeout(timeout).get(); ..... //get new sellers try one Elements links = document.select("a[href]"); for (Element link : links) { // System.out.println("Span olp:"+link.text()); String code = link.attr("abs:href"); String label = trim(link.text(), 35); if (label.contains("new")) { System.out.println(label + " : " + code); } } //get new sellers try one Elements links = document.select("div.mbcOlpLink"); for (Element link : links) { // System.out.println("Span olp:"+link.text()); } //about a million other failed attempts that you'll just have to take my word on. </code></pre> <p>I've been successful when scrape everything else I need on the page, but for some reason this particular element is being a pain, any help would be GREAT! Thanks guys!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload