kagasu / GooglePlayStoreApi

Google Play Store API for .NET(unofficial)
MIT License
20 stars 6 forks source link

How to Download APKs Bundle? #9

Closed rezionline closed 4 years ago

rezionline commented 4 years ago

Hi, How can to download APKs Bundle for some apps and games that's are being released to this model? And how can determine the type of Architecture and Android version? Thanks

kagasu commented 4 years ago

How can to download APKs Bundle

The answer is AdditionalFile. Example.

var client = new GooglePlayStoreClient(email, androidId, proxy)
{
    Country = CountryCode.Japan
};
var token = "aas_et/...";
await client.GetGoogleAuth(token);

var packageName = "com.gameloft.android.ANMP.GloftA9HM";

var appDetail = await client.AppDetail(packageName);
var versionCode = appDetail.DocV2.Details.AppDetails.VersionCode;
var offerType = appDetail.DocV2.Offer[0].OfferType;

var appDelivery = await client.AppDelivery(packageName, offerType, versionCode);
var apkDownloadUrl = appDelivery.AppDeliveryData.DownloadUrl;
// APK file download url
Console.WriteLine(apkDownloadUrl);

foreach (var x in appDelivery.AppDeliveryData.AdditionalFile)
{
    // Additional file download url
    Console.WriteLine(x.DownloadUrl);
}

how can determine the type of Architecture and Android version?

Play Store API is generate response depend on GSF ID(Google Service Framework ID) and User-Agent. GSD ID includes many information,

So, you can't manually set (request) architecture and android version, i think. If you want do this, you have to implement checkin request https://github.com/kagasu/GooglePlayStoreApi/issues/1

rezionline commented 4 years ago

For example, I don't get AdditionalFile for this package: com.firsttouchgames.smp

Untitled-1

While Online APK Downloader sites provide several apk download links for this (for Android 5.0 and armeabi-v7a Architecture on this test):

Untitled-3

kagasu commented 4 years ago

Version 1.0.6 is released. Support SplitApkData.

Example.

var appDelivery = await client.AppDelivery(packageName, offerType, versionCode);
foreach (var x in appDelivery.AppDeliveryData.SplitApkData)
{
  Console.WriteLine($"FileName: {x.FileName}.apk");
  Console.WriteLine($"URL: {x.DownloadUrl}");
}

Output

FileName: config.hdpi.apk
URL: https://play.googleapis.com/download...
FileName: config.armeabi_v7a.apk
URL: https://play.googleapis.com/download...
rezionline commented 4 years ago

Thank you But i didn't understand how to specify Architecture and Android version like this site at the time of download:

73426478-b36a8e80-4349-11ea-8906-3e01637907db

kagasu commented 4 years ago

Please read this again. https://github.com/kagasu/GooglePlayStoreApi/issues/9#issuecomment-579689114

You can pass User-Agent through GooglePlayStoreClient constructor. If you want need Android 10 response, you have to set sdk=29. https://source.android.com/setup/start/build-numbers?hl=en

Device and Architecture is GSF ID(Google Service Framework ID) side problem, i think. Use this library, you can generate new GSF ID.(I'm not tested it)

api.getGsfId();

https://github.com/yeriomin/play-store-api