[Extension] Updated version of the APK Downloader Chrome Extension

Search This thread

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
I tried modding the extension but for some reason it even fails with localhost instead of this thread, just replacing the 1 line containing the url *confused* (not a chrome extension guy so probably missing something there. more of a web dev)
Maybe if you'd explain why that is and why it needs some site in the first place I'd be able to figure it out.

You need to change two files. The "match"-url for the content script in manifest.json, needs to match the url for the chrome.tabs.create call in main.js:

1.) manifest.json
Code:
"content_scripts": [
  {
    "matches": ["http://xdaforums.com/showthread.php?t=1809458&download=apk*"],
    "js": ["download.js"]
  },

2.) main.js
Code:
executeRawHttpsQuery:function(c) {
  chrome.tabs.create({url:"http://xdaforums.com/showthread.php?t=1809458&download=apk#" + c})
}};
 

XlAfbk

Senior Member
Aug 11, 2010
1,484
440
doh. I greped *.js only ...
hm, i see, a page needs to be opened because chrome extensions can only inject scripts into existing pages so to be able to call the function it needs a tab. will have to learn about chrome extensions to try to change that i guess.
 

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
doh. I greped *.js only ...
hm, i see, a page needs to be opened because chrome extensions can only inject scripts into existing pages so to be able to call the function it needs a tab. will have to learn about chrome extensions to try to change that i guess.

more exactly, the page doesn't need to exist. but you need any URL as a "trigger" to call the content script (eg download script). however, I just had an idea. It may be possible to reload the actual play store url and append the hash key to that URL. Let me check on that..
 

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
APK Downloader 1.3.2

Changelog
This version will no longer open a new tab.
Instead, it will reload the Play Store Url within the same tab in which you clicked on the extension icon and start the download.
 

Attachments

  • apkdownloader-bexmod-1.3.2.zip
    42.7 KB · Views: 1,430

Felimenta97

Senior Member
Aug 5, 2011
7,863
2,305
26
Ribeirão Preto
Well, it doesn't work at all here. It quickly gives a sign the page is reloading but nothing changes, and there is only a small white box below the APK downloader icon...
 

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
Well, it doesn't work at all here. It quickly gives a sign the page is reloading but nothing changes, and there is only a small white box below the APK downloader icon...

Okay, sorry for the mess. But that's when you working with somebody else's code. :p I re-wrote the extension a clean way and reduced the number of files from 16 to 12. Everything should work now as expected with the 1.3.2 release.

Means: By clicking on the page action icon (the market case), the current page in your browser will reload the same URL (+ &download=apk#SOMEHASHKEY) and start the download.

I've tested it with about 20 apks and it worked out without any issues. But please leave some feedback to ensure it is working for "all" chrome versions.
 

ytain

Senior Member
Feb 25, 2011
57
11
Still doesn't work for me, it doesn't download anything even for those I can get via market in Android on my tablet.
 

XlAfbk

Senior Member
Aug 11, 2010
1,484
440
Still doesn't work for me, it doesn't download anything even for those I can get via market in Android on my tablet.
I'd guess you missed the last step of the instructions: "However, you need to follow 1 more step to actually use it; you need to disable SSL warnings. Therefore please read on at the original APK Downloader page at: http://codekiem.com/2012/02/24/apk-downloader/"

@Bexton: imho it should be possible to eliminate the need for some page to be opened completly:
put requestAsset() in background.js
replace chrome.tabs.update() with requestAssets() call
send all the stuff that's currently handled with cookies directly in that call

I tried doing it but I just can't figure out Chromes dev tools. Didn't even find where to view the extensions scripts in the dev tools. And using alerts for that kind of stuff is pretty annoying ;)

Oh, and main.js can be removed from the package as well, it's not called anywhere.
 
Last edited:
  • Like
Reactions: Bexton

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
With the last two version (released yesterday), tried to remove the thing that you get a new tab opened with every download. After rewriting a lot of the code, that worked quite well for me. However, I noticed that if a Play Store URL already contains a hash key, the regex can not get the request key properly and therefor the download does not start. Now, here's the next version with a fix for this issue:

APK Downloader 1.3.4

Changelog
* Improved new reload function to support Play Store URLs that contain a hash key already.
 

Attachments

  • apkdownloader-bexmod-1.3.4.zip
    43.1 KB · Views: 59,490

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
@Bexton: imho it should be possible to eliminate the need for some page to be opened completly:
put requestAsset() in background.js
replace chrome.tabs.update() with requestAssets() call
send all the stuff that's currently handled with cookies directly in that call

should be possible.. will try that

Oh, and main.js can be removed from the package as well, it's not called anywhere.

Good catch! I just forgot to remove it when I merged that code with background.js. The original code was really a mess. ^^
 

ytain

Senior Member
Feb 25, 2011
57
11
I'd guess you missed the last step of the instructions: "However, you need to follow 1 more step to actually use it; you need to disable SSL warnings. Therefore please read on at the original APK Downloader page at: http://codekiem.com/2012/02/24/apk-downloader/"

The APK Downloader worked for me before so I already knew about the disabling the SSL warnings.

Tested again the version 1.3.4. It works only for the stuff that I can download thru the market app on the tablet, but not for the other free ones that don't show up on the market app on the tablet.

I guess Google smartened up on this one, or it's detecting the ip address you are connecting from. I guess I have to try a proxy so I'm reluctant.

Ytain
 

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
Tested again the version 1.3.4. It works only for the stuff that I can download thru the market app on the tablet, but not for the other free ones that don't show up on the market app on the tablet.

Well, that is how the extension is meant to work. It is meant as an alternative way to download those apps, that you can download through the play store anyway. It will not bypass any restrictions - and it never did.

I guess Google smartened up on this one,...

Maybe they tightened the restrictions (as for which apps can be downloaded by which device)?!

...or it's detecting the ip address you are connecting from. I guess I have to try a proxy so I'm reluctant

IPs doesn't matter here at all - Google knows you anyway. :p
 

ytain

Senior Member
Feb 25, 2011
57
11
[/COLOR]
Well, that is how the extension is meant to work. It is meant as an alternative way to download those apps, that you can download through the play store anyway. It will not bypass any restrictions - and it never did.

Well I was able to download the free ones that don't show in the market on the tablet with the old version before your updated extension. Does that mean something changed in the Chrome or just the way the Play Store API processed the requests?

or just use a non-restricted (dpi patched) market on your device

That does not work as well. Same result.

Ytain
 
Last edited:

Bexton

Senior Member
Sep 26, 2011
643
1,129
50° 56' 33" 6° 57' 32"
Well I was able to download the free ones that don't show in the market on the tablet with the old version before your updated extension. Does that mean something changed in the Chrome or just the way the Play Store API processed the requests?

If it was possible and is no longer, I guess that the most likely reason is a change in the way the Play Store API processes the requests (that's btw what I meant with "tightened restrictions"). But this is neither due to my changes on the extension, nor due to changes in Chrome.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 69
    What is it?

    This is an updated (and slightly modified) version of redphx's awesome Google Chrome extension APK Downloader.
    It allows you to download APKs from the Play Store webpage via your desktop browser directly onto your computer.

    The original version stopped working as of Google Chrome version 20+ because starting with this Chrome version, all Google Chrome extension require to use the manifest version 2. When I noticed, I checked the author's page for any updates. But there were no updates on that.

    Update: Earlier, I said that the original APK Downloader extension stopped working because it uses Manifest version 1 and that Google Chrome dropped support for all extensions that use Manifest version 1.

    However, gt573 noted that he can still use the original extension (v1.2.1) with Chrome 21.

    So, I checked again the Manifest version 1 support schedule and I found that I was wrong there. Manifest version 1 was announced deprecated with the release of Chrome 18, but will be partitially supported until "early 2013".

    Nethertheless, the original APK Downloader (v1.2.1) does not work for me since my Chrome was update to 21.0.1180.60 m. The extension constantly throws content security policy exceptions when trying to download any App, which prevents the extension from working at all. Additionally, this is the error message I get on the extension page:

    23tpo93.jpg


    And according to the recent comments on the author's webpage, there's a bunch of other users who have/had the same problem with v1.2.1 within the last days. (For a detailed explanation of manifest version changes in Chrome and what that means for the original APK Downloader, click here to read the full story.)

    So: If APK Downloader v1.2.1 stopped working for you, feel free to use this updated version.

    What was changed?

    So.. Basically, this is the original APK Downloader v1.2.1 extension for the Google Chrome browser, downloaded from the author's - redphx - webpage. However, these are the changes that I made:

    As of version 1.3.0
    • Updated the extension manifest version from 1 to 2
    • Replaced deprecated functions in JavaScript and references in manifest.json
    • Changed JavaScript formatting from compressed to "Pretty Print" (so that the source code is readable for everybody)
    • Removed Google Analytics Code (Sorry redphx, all credits to you! But using GA for this, without even anonymizing the User IPs, is a No-Go as I think).
    • Changed the download redirect Url (when clicking the icon in the Url bar) from the author's webpage to a local domain "http://localhost/[..]".
    • Removed all other "extra" code, that was not used for the actual functionality.
    • Replaced extension icons.

    As of version 1.3.1
    • Changed the download redirect Url (when clicking the icon in the Url bar) from"http://localhost/[..]" to this thread's URL, because v1.3.0 required a local web server to be running for the extension in order to function.

    As of version 1.3.2
    • Changed the download redirect Url (when clicking the icon in the Url bar). Instead of open a new tab, as of version 1.3.2 it will simply reload the current Play Store URL and start the download!

    As of version 1.3.3
    • Fixed redirect bug, introduced in version 1.3.2
    • Major code clean up (reduced number of files from 16 to 12).

    As of version 1.3.4
    • Improved new reload function to support Play Store URLs that contain a hash key already.


    Get Started - Download
    To install the extension the steps are as follows: download and extract the following zip archive to your computer.

    Direct download link:
    apkdownloader-1.3.1.zip
    apkdownloader-1.3.2.zip
    apkdownloader-1.3.3.zip
    apkdownloader-1.3.4.zip

    How to set up?

    After you extracted the downloaded zip file to your computer, open Google Chrome and go to the extension page; you can copy and paste into the Url bar: chrome://chrome/extensions/

    Load it

    Now, enable "Developer mode" and load the "APK Downloader"-extension from the directory where you extracted it to.
    2jg2ecp.jpg


    Set it up - Google-Account

    To be able to download from the Play Store, you need to authenticate all requests. Therefore you need to "log in to your Google Account" at the extension's option page.
    svkuhx.jpg


    On the extension's options page, log in with your Google-Account (email-address and password) - the same Account that you used with your device! Also, you will need your Android Device-Id (which is part of the algorithm to generate a valid request key).

    Note: Basically this is not a "login" in the common sense. Your credentials are stored safely in Chrome's local data storage - on your own computer!!!

    Set it up - Android Device-Id

    To get your Android Device-Id, type in the dialer of your phone...
    Code:
    *#*#8255#*#*
    *#*#TALK*#*#

    ... and you will get the "GTalk Service Monitor" screen like the following. Search for "DEVICE-ID:". Everything that comes after "android-", that is your Device-Id.

    b6u450.jpg


    OR

    Use my App "Android Device-ID"

    hKKum.jpg


    (Almost) Done

    2j0cfma.jpg


    The extension is now available and ready set up. However, you need to follow 1 more step to actually use it; you need to disable SSL warnings. Therefore please read on at the original APK Downloader page at: http://codekiem.com/2012/02/24/apk-downloader/


    Credits
    All credits for the extension goes to redphoenix89 (or redphx @xda)! It's his code - I did only cosmetics.

    Legal Note / Disclaimer
    Finally, please note that the use of this Chrome extension is violating Google's Play Store TOS! You've been warned.
    11
    As promised, the repo and a zip:

    Chrome extension directly available on https://lekensteyn.nl/apk-downloader/
    Project repo (zip at downloads): https://github.com/Lekensteyn/apk-downloader

    Changelog for 1.4.1 - 2013-01-13:
    • Packaging-only change, add update URL to manifest file and provided ready-to-install CRX file.

    Changelog for version 1.4 - 2012-12-09:

    • Rewrite Javascript core of extension, do not make it look too obfuscated.
    • Chromium 23 compatibility. Due to restrictions on changing headers for clients.google.com, a new approach on retrieving the download URL and actually downloading an APK is implemented.
    • Due to the rewrite, you should not need to disable SSL warnings anymore.
    • Add help to options page.
    • Hide SIM operator options by default as you usually do not need those.

    @OP: please update the first post. Contributions are always welcome, simply do a pull request.
    9
    APK Downloader Chrome Extension 1.5.0

    I've released version 1.5.0 with some fixes:

    • Compatibility with new Play store (reported by existeam, Gaganpreet).
    • Detect when login has expired before downloading and open options page if necessary (requires new permission: access to tabs)
    • Insert email and device ID when trying to re-login (saves you from retyping this combination when session has expired).

    You can get it from https://lekensteyn.nl/apk-downloader/ as usual, source code at https://github.com/Lekensteyn/apk-downloader. This extension contains NO TRACKING CODE unlike Evozi's fork.

    Evozi's fork is based on opensource 1.4.x, with tracking code and removes validation for undownloadable APKs as a fix for new play store. Besides this, it also removes the copyright header of background.js, adds more tracking and some textual changes (adding links to his own apps and social accounts).

    Codekiems 1.4.3 is a modification of the open-source APK Downloader 1.4.2 plus fix for the English Google Play only (i.e. it does not work for other languages). Besides this, it also changes the home page and update URL to his domain.
    4
    Also DL purchased

    I changed line 7 in background.js, so the extension would also download purchased apps and not just free apps from this:
    Code:
        b && b.html && -1 < b.html.indexOf('data-isfree="true"') && chrome.pageAction.show(a)
    to this:
    Code:
        b && b.html && (-1 < b.html.indexOf('data-isfree="true"') || -1 < b.html.indexOf('data-ispurchased="true"')) && chrome.pageAction.show(a)
    4
    I got it fixed for Chromium 23. It required a rewrite because of policy changes that cause captures/modifications of the *clients.google.com domain being blocked.

    I'll polish it a further more with my brother and then get it published in a public git repository. Stay tuned, it should be ready tomorrow or the day thereafter.