0

I want to create an Android App that can download all available images of in-game screenshots posted on Angry Birds or any app's Google Play Store page. How can I go about it?

I have tried using this API (https://code.google.com/p/android-market-api/), but I was hoping for better alternatives(the creator of the API had warned that with each new release of Google's SDK, the API may not work properly).

If there is no API readily available, then maybe some broad guidelines?

Do I use a Java based web page crawler and adapt it to Android code or an API like JavaHTMLEditor? In this example (http://www.compiletimeerror.com/2013/08/java-downloadextract-all-images-from.html#.VFPe3_nF8WI) the program uses JavaHTMLEditor to pull all images from an HTML webpage, but I'm not sure it will work in Google Play store app pages.

Any kind of advice would be greatly appreciated!!

  • 1
    I created something similar a while ago (2 months) for my website, I went through hundreds of libraries but ended up creating a crawler myself. – Rolf ツ Oct 31 '14 at 20:12

1 Answers1

0

I'd go with quite straight forward solution.

1) load the actual google play game webpage with normal http request in your application code

Good examples: (StringRequest should do the trick):

http://developer.android.com/training/volley/requestqueue.html https://developer.android.com/training/volley/simple.html

2) create a simple analysis logic that knows what to look for in the response html structure

For example in your case, the image links you are looking for are currently wrapped like this:

(I took this code from a sample game google play html source and modified a bit)

<div class="expand-page" style="width: 100%; opacity: 0;">
  <div class="screenshot-container" style="display: inline-block;"> 
    <div class="screenshot-align"> 
       <div class="screenshot-align-inner"> 
          <img class="full-screenshot clickable" alt="Alt" 
               data-expand-fit-screen="true" data-expand-scroll="true" 
               data-expand-target="full-screenshot-0" data-expand-to="full-screenshot-1" 
               src="https://this.is.the.interesting/url.part"> 
       </div> 
    </div> 
  </div>
</div>

You are interested in finding all of the class="full-screenshot clickable" img tags and their src values. You can go about this for example with regular expression style or indexOf/substring combination to find what you want in the String response.

Michikawa
  • 123
  • 1
  • 7
  • Hi, I'm not familiar with using img tags or src values in code, could you please point me to some resources? – user3172231 Nov 05 '14 at 11:09
  • The complete solution is a bit complex to be written in a single response, but for example: http://stackoverflow.com/questions/17908302/extract-url-from-java-string-containing-img-src-tag has some discussion regarding indexOf -style solution. – Michikawa Nov 13 '14 at 11:31
  • Basic idea is that you consider the html source to be a String from which you are trying to find certain substrings and collect them into a list. You can analyze the string by finding the indexOf pattern full-screenshot clickable and take a substring from that index to the indexOf next you can find. Then you will have a String containing the right src="..." pattern and find the url with similar indexOf analysis for each. – Michikawa Nov 13 '14 at 11:34
  • Hey thanks a lot for your help. I used Android Volley's String Request in combination with Jsoup (http://jsoup.org/cookbook/extracting-data/attributes-text-html). I was able to extract data by searching for a specific atrribute-value combo(class" and "full-screenshot" in this case), and I was able to extract screenshot images! Thanks again! :) – user3172231 Nov 13 '14 at 23:35