apk

package
v0.0.0-...-559c49c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

The GPLv3 License (GPLv3)

Copyright (c) 2023 Amaan Qureshi <amaanq12@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

The GPLv3 License (GPLv3)

Copyright (c) 2023 Amaan Qureshi <amaanq12@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

The GPLv3 License (GPLv3)

Copyright (c) 2023 Amaan Qureshi <amaanq12@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	CurrentVersion string
	Path           = flag.String("path", ".", "output directory for /assets")
	Client         = LoadRetryClient()
	Log            = log.New(os.Stdout).WithColor().WithDebug().WithTimestamp()
)
View Source
var (
	ClashofClans = GameLink{URL: "https://clash-of-clans.en.uptodown.com/android/versions/%d", Name: "Clash of Clans", ValidDirectories: []string{"csv", "localization", "logic"}}
	ClashRoyale  = GameLink{URL: "https://clash-royale.en.uptodown.com/android/versions/%d", Name: "Clash Royale"}
	BrawlStars   = GameLink{URL: "https://brawl-stars.en.uptodown.com/android/versions/%d", Name: "Brawl Stars", ValidDirectories: []string{"csv_client", "csv_logic", "localization", "logic"}}
	ClashMini    = GameLink{URL: "https://clash-mini.en.uptodown.com/android/versions/%d", Name: "Clash Mini"}
	HayDay       = GameLink{URL: "https://hay-day.en.uptodown.com/android/versions/%d", Name: "Hay Day", ValidDirectories: []string{"data", "localization"}}
	ClashQuest   = GameLink{URL: "https://clash-quest.en.uptodown.com/android/versions/%d", Name: "Clash Quest"}
	BoomBeach    = GameLink{URL: "https://boom-beach.en.uptodown.com/android/versions/%d", Name: "Boom Beach"}
	Everdale     = GameLink{URL: "https://everdale.en.uptodown.com/android/versions/%d", Name: "Everdale"}
	HayDayPop    = GameLink{URL: "https://hay-day-pop.en.uptodown.com/android/versions/%d", Name: "Hay Day Pop"}
	RushWars     = GameLink{URL: "https://rush-wars.en.uptodown.com/android/versions/%d", Name: "Rush Wars"}

	AllGameLinks = []GameLink{
		ClashofClans,
		ClashRoyale,
		BrawlStars,
		ClashMini,
		HayDay,
		ClashQuest,
		BoomBeach,
		Everdale,
		HayDayPop,
		RushWars,
	}

	ErrLastPage = fmt.Errorf("End of the Line!")
)

Functions

func CleanUp

func CleanUp(assetsFP, apkFP string) error
func CurlAPKLink(link string) (*html.Node, error)

Get uptodowns HTML page

func DecompileAPK

func DecompileAPK(apkPath string) error

Executes apktool and removes the apk file

func GetCurrentAPKVersion

func GetCurrentAPKVersion(_print bool) (string, error)

Parses the uptodown HTML node for the current game version

func GetDownloadURL

func GetDownloadURL(url string) (string, error)

Parses the uptodown HTML node for the download link

func LoadRetryClient

func LoadRetryClient() *retryablehttp.Client

func UpdateAPK

func UpdateAPK() error

func WalkAndDecompressAssets

func WalkAndDecompressAssets(validDirs []string, fpToDecompiledAPK, fpToOutputFiles string) (string, error)

Walk the assets folder and decompress each file inside

func WgetAPK

func WgetAPK(game *GameLink, downloadUrl, version, fp string) (string, error)

Download the APK from uptodown with a progress bar

Types

type AggregateRating

type AggregateRating struct {
	Type        string `json:"@type"`
	RatingValue string `json:"ratingValue"`
	RatingCount string `json:"ratingCount"`
	BestRating  string `json:"bestRating"`
	WorstRating string `json:"worstRating"`
}

type Author

type Author struct {
	Type             string           `json:"@type"`
	Name             string           `json:"name"`
	MainEntityOfPage MainEntityOfPage `json:"mainEntityOfPage"`
	URL              string           `json:"url"`
}
type GameLink struct {
	URL              string
	Name             string
	ValidDirectories []string
}

type InLanguage

type InLanguage struct {
	Type string `json:"@type"`
	Name string `json:"name"`
}

type InteractionStatistic

type InteractionStatistic struct {
	Type                 string `json:"@type"`
	InteractionType      string `json:"interactionType"`
	UserInteractionCount string `json:"userInteractionCount"`
}

type IsPartOf

type IsPartOf struct {
	Type            string          `json:"@type"`
	URL             string          `json:"url"`
	Publisher       Publisher       `json:"publisher"`
	PotentialAction PotentialAction `json:"potentialAction"`
}

type MainEntity

type MainEntity struct {
	Type                   string               `json:"@type"`
	Name                   string               `json:"name"`
	URL                    string               `json:"url"`
	Description            string               `json:"description"`
	Image                  string               `json:"image"`
	OperatingSystem        string               `json:"operatingSystem"`
	SoftwareVersion        string               `json:"softwareVersion"` // This is the one
	DatePublished          string               `json:"datePublished"`
	InteractionStatistic   InteractionStatistic `json:"interactionStatistic"`
	ApplicationCategory    string               `json:"applicationCategory"`
	ApplicationSubCategory string               `json:"applicationSubCategory"`
	Author                 Author               `json:"author"`
	Offers                 Offers               `json:"offers"`
	AggregateRating        AggregateRating      `json:"aggregateRating"`
	Screenshot             []Screenshot         `json:"screenshot"`
	InLanguage             []InLanguage         `json:"inLanguage"`
}

type MainEntityOfPage

type MainEntityOfPage struct {
	Type string `json:"@type"`
	ID   string `json:"@id"`
}

type MetaData

type MetaData struct {
	Context    string     `json:"@context"`
	Type       string     `json:"@type"`
	URL        string     `json:"url"`
	IsPartOf   IsPartOf   `json:"isPartOf"`
	MainEntity MainEntity `json:"mainEntity"`
}

type Offers

type Offers struct {
	Type          string `json:"@type"`
	Price         string `json:"price"`
	PriceCurrency string `json:"priceCurrency"`
}

type PotentialAction

type PotentialAction struct {
	Type       string `json:"@type"`
	Target     string `json:"target"`
	QueryInput string `json:"query-input"`
}

type Publisher

type Publisher struct {
	ID string `json:"@id"`
}

type Screenshot

type Screenshot struct {
	Type string `json:"@type"`
	URL  string `json:"url"`
}

type VersionData

type VersionData struct {
	Version     string
	URL         string
	Date        string
	DownloadURL string
}

func GetAllVersions

func GetAllVersions(gamelink string) ([]VersionData, error)

func GetVersions

func GetVersions(gamelink string, page int) ([]VersionData, error)

type WgetReader

type WgetReader struct {
	io.Reader
	Length   int64
	Reporter func(r int64)
}

func (*WgetReader) Read

func (wg *WgetReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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