gplayapi

package module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 13 Imported by: 1

README

gplayapi-go

Small google play api wrapper in go.

Get AASToken using Authenticator app.

Documentation

Index

Constants

View Source
const (
	ImageTypeAppScreenshot = iota + 1
	ImageTypePlayStorePageBackground
	ImageTypeYoutubeVideoLink
	ImageTypeAppIcon
	ImageTypeCategoryIcon
	ImageTypeYoutubeVideoThumbnail = 13

	UrlBase               = "https://android.clients.google.com"
	UrlFdfe               = UrlBase + "/fdfe"
	UrlAuth               = UrlBase + "/auth"
	UrlCheckIn            = UrlBase + "/checkin"
	UrlDetails            = UrlFdfe + "/details"
	UrlDelivery           = UrlFdfe + "/delivery"
	UrlPurchase           = UrlFdfe + "/purchase"
	UrlToc                = UrlFdfe + "/toc"
	UrlTosAccept          = UrlFdfe + "/acceptTos"
	UrlUploadDeviceConfig = UrlFdfe + "/uploadDeviceConfig"
)

Variables

View Source
var (

	// Pixel3a is default device which uses arm64 and Android 9 / SDK 28
	Pixel3a = &DeviceInfo{
		Build: &DeviceBuildInfo{
			AndroidBuildProto: &gpproto.AndroidBuildProto{
				BuildProduct:   sargo,
				Radio:          ptrStr("g670-00011-190411-B-5457439"),
				Bootloader:     ptrStr("b4s4-0.1-5613380"),
				Carrier:        ptrStr("google"),
				Device:         sargo,
				Model:          ptrStr("Pixel 3a"),
				Manufacturer:   ptrStr("google"),
				Product:        sargo,
				Id:             ptrStr("PQ3B.190705.003"),
				SdkVersion:     ptrInt32(28),
				Client:         androidGoogle,
				GoogleServices: ptrInt32(203615028),
				OtaInstalled:   falsePtr,
			},
			VersionRelease: 9,
		},
		SimOperator:  "20815",
		Platforms:    []string{"arm64-v8a", "armeabi-v7a", "armeabi"},
		CellOperator: "334050",
		Roaming:      roaming,
		TimeZone:     "America/Mexico_City",
		TouchScreen:  3,
		Keyboard:     1,
		Navigation:   1,
		ScreenLayout: 2,
		Screen: &DeviceInfoScreen{
			Density: 490,
			Width:   1080,
			Height:  2073,
		},
		GLVersion:       glVersion,
		GLExtensions:    glExtensions,
		SharedLibraries: sharedLibraries,
		Features:        features,
		Locales:         locales,
	}

	// Redmi4 is device which uses arm and Android 10 / SDK 29
	Redmi4 = &DeviceInfo{
		Build: &DeviceBuildInfo{
			AndroidBuildProto: &gpproto.AndroidBuildProto{
				BuildProduct:   santoni,
				Radio:          ptrStr("MPSS.TA.2.3.c1-00395-8953_GEN_PACK-1_V048"),
				Bootloader:     unknown,
				Carrier:        ptrStr("Xiaomi"),
				Device:         santoni,
				Model:          ptrStr("Redmi 4"),
				Manufacturer:   ptrStr("Xiaomi"),
				Product:        santoni,
				Id:             ptrStr("QQ3A.200805.001"),
				SdkVersion:     ptrInt32(29),
				Client:         androidGoogle,
				GoogleServices: ptrInt32(203315024),
				OtaInstalled:   falsePtr,
			},
			VersionRelease: 10,
		},
		SimOperator:  "21601",
		Platforms:    []string{"armeabi-v7a", "armeabi"},
		CellOperator: "21601",
		Roaming:      roaming,
		TimeZone:     "Europe/Budapest",
		TouchScreen:  3,
		Keyboard:     1,
		Navigation:   1,
		ScreenLayout: 3,
		Screen: &DeviceInfoScreen{
			Density: 224,
			Width:   720,
			Height:  1280,
		},
		GLVersion:       glVersion,
		GLExtensions:    glExtensions,
		SharedLibraries: sharedLibraries,
		Features:        features,
		Locales:         locales,
	}

	// Emulator_x86_64 is device which uses x86_64 and Android 11 / SDK 30
	Emulator_x86_64 = &DeviceInfo{
		Build: &DeviceBuildInfo{
			AndroidBuildProto: &gpproto.AndroidBuildProto{
				BuildProduct:   ptrStr("sdk_phone_x86_64"),
				Radio:          ptrStr("1.0.0.0"),
				Bootloader:     unknown,
				Carrier:        android,
				Device:         ptrStr("generic_x86_64"),
				Model:          ptrStr("Android SDK built for x86_64"),
				Manufacturer:   unknown,
				Product:        ptrStr("sdk_phone_x86_64"),
				Id:             ptrStr("RSR1.210722.012"),
				SdkVersion:     ptrInt32(30),
				Client:         androidGoogle,
				GoogleServices: ptrInt32(203019037),
				OtaInstalled:   falsePtr,
			},
			VersionRelease: 11,
		},
		SimOperator:  "38",
		Platforms:    []string{"x86_64", "x86"},
		CellOperator: "310",
		Roaming:      roaming,
		TimeZone:     "UTC-10",
		TouchScreen:  3,
		Keyboard:     2,
		Navigation:   2,
		ScreenLayout: 2,
		Screen: &DeviceInfoScreen{
			Density: 420,
			Width:   1080,
			Height:  1794,
		},
		GLVersion:       glVersion,
		GLExtensions:    glExtensionsEmulator,
		SharedLibraries: sharedLibraries,
		Features:        features,
		Locales:         locales,
	}

	// Emulator_x86 is device which uses x86 and Android 11 / SDK 30
	Emulator_x86 = &DeviceInfo{
		Build: &DeviceBuildInfo{
			AndroidBuildProto: &gpproto.AndroidBuildProto{
				BuildProduct:   ptrStr("sdk_phone_x86"),
				Radio:          ptrStr("1.0.0.0"),
				Bootloader:     unknown,
				Carrier:        android,
				Device:         ptrStr("generic_x86"),
				Model:          ptrStr("Android SDK built for x86"),
				Manufacturer:   unknown,
				Product:        ptrStr("sdk_phone_x86"),
				Id:             ptrStr("RSR1.210722.012"),
				SdkVersion:     ptrInt32(30),
				Client:         androidGoogle,
				GoogleServices: ptrInt32(203019037),
				OtaInstalled:   falsePtr,
			},
			VersionRelease: 11,
		},
		SimOperator:  "38",
		Platforms:    []string{"x86"},
		CellOperator: "310",
		Roaming:      roaming,
		TimeZone:     "UTC-10",
		TouchScreen:  3,
		Keyboard:     2,
		Navigation:   2,
		ScreenLayout: 2,
		Screen: &DeviceInfoScreen{
			Density: 420,
			Width:   1080,
			Height:  1794,
		},
		GLVersion:       glVersion,
		GLExtensions:    glExtensionsEmulator,
		SharedLibraries: sharedLibraries,
		Features:        features,
		Locales:         locales,
	}
)
View Source
var ErrNilPayload = errors.New("got nil payload from google play")
View Source
var (
	GPTokenExpired = errors.New("unauthorized, gp token expired")
)

Functions

This section is empty.

Types

type App

type App struct {
	PackageName        string
	AppInfo            *AppInfo
	CategoryImage      *gpproto.Image
	CategoryID         int
	CategoryName       string
	Changes            string
	ContainsAds        bool
	CoverImage         *gpproto.Image
	Description        string
	DeveloperName      string
	DisplayName        string
	DownloadString     string
	EarlyAccess        bool
	IconImage          *gpproto.Image
	InstantAppLink     string
	IsFree             bool
	IsSystem           bool
	LiveStreamUrl      string
	OfferDetails       map[string]string
	OfferType          int32
	Price              string
	PromotionStreamUrl string
	Screenshots        []*gpproto.Image
	ShareUrl           string
	ShortDescription   string
	Size               int64
	TargetSdk          int
	TestingProgram     *TestingProgram
	UpdatedOn          string
	VersionCode        int
	VersionName        string
	Video              *gpproto.Image
}

type AppInfo

type AppInfo struct {
	AppInfoMap map[string]string
}

type AuthData

type AuthData struct {
	Email                         string
	AASToken                      string
	AuthToken                     string
	GsfID                         string
	DeviceCheckInConsistencyToken string
	DeviceConfigToken             string
	DFECookie                     string
	Locale                        string
}

type DeviceBuildInfo

type DeviceBuildInfo struct {
	*gpproto.AndroidBuildProto
	VersionRelease int
}

type DeviceInfo

type DeviceInfo struct {
	Build           *DeviceBuildInfo
	SimOperator     string
	Platforms       []string
	OtaInstalled    bool
	CellOperator    string
	Roaming         string
	TimeZone        string
	TouchScreen     int32
	Keyboard        int32
	Navigation      int32
	ScreenLayout    int32
	Screen          *DeviceInfoScreen
	GLVersion       int32
	GLExtensions    []string
	SharedLibraries []string
	Features        []string
	Locales         []string
}

func (*DeviceInfo) GenerateAndroidCheckInRequest

func (i *DeviceInfo) GenerateAndroidCheckInRequest() *gpproto.AndroidCheckinRequest

func (*DeviceInfo) GetAuthUserAgent

func (i *DeviceInfo) GetAuthUserAgent() string

func (*DeviceInfo) GetDeviceConfigProto

func (i *DeviceInfo) GetDeviceConfigProto() *gpproto.DeviceConfigurationProto

func (*DeviceInfo) GetDeviceFeatures

func (i *DeviceInfo) GetDeviceFeatures() (ret []*gpproto.DeviceFeature)

func (*DeviceInfo) GetUserAgent

func (i *DeviceInfo) GetUserAgent() string

type DeviceInfoScreen

type DeviceInfoScreen struct {
	Density int32
	Width   int32
	Height  int32
}

type GooglePlayClient

type GooglePlayClient struct {
	AuthData   *AuthData
	DeviceInfo *DeviceInfo

	// SessionFile if SessionFile is set then session will be saved to it after modification
	SessionFile string
}

func LoadSession

func LoadSession(file string) (*GooglePlayClient, error)

func LoadSessionWithDeviceInfo

func LoadSessionWithDeviceInfo(file string, deviceInfo *DeviceInfo) (client *GooglePlayClient, err error)

func NewClient

func NewClient(email, aasToken string) (*GooglePlayClient, error)

NewClient makes new client with Pixel3a config

func NewClientWithDeviceInfo

func NewClientWithDeviceInfo(email, aasToken string, deviceInfo *DeviceInfo) (client *GooglePlayClient, err error)

func (*GooglePlayClient) GenerateGPToken

func (client *GooglePlayClient) GenerateGPToken() (string, error)

func (*GooglePlayClient) GenerateGsfID

func (client *GooglePlayClient) GenerateGsfID() (gsfID string, err error)

func (*GooglePlayClient) GetAppDetails

func (client *GooglePlayClient) GetAppDetails(packageName string) (*App, error)

func (*GooglePlayClient) GetBuyResponse

func (client *GooglePlayClient) GetBuyResponse(packageName string, version int) (*gpproto.BuyResponse, error)

func (*GooglePlayClient) GetDeliveryResponse

func (client *GooglePlayClient) GetDeliveryResponse(packageName string, version int) (*gpproto.DeliveryResponse, error)

func (*GooglePlayClient) Purchase

func (client *GooglePlayClient) Purchase(packageName string, version int) (*gpproto.AndroidAppDeliveryData, error)

func (*GooglePlayClient) RegenerateGPToken added in v0.0.2

func (client *GooglePlayClient) RegenerateGPToken() (err error)

func (*GooglePlayClient) SaveSession

func (client *GooglePlayClient) SaveSession(file string) error

type TestingProgram

type TestingProgram struct {
	Image       *gpproto.Image
	DisplayName string
	Email       string
	IsAvailable bool

	IsSubscribedAndInstalled bool
	// contains filtered or unexported fields
}

type TestingProgramStatus

type TestingProgramStatus struct {
	Subscribed   bool
	Unsubscribed bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL