Skip to content

Commit

Permalink
feat: complete re-write using bun
Browse files Browse the repository at this point in the history
  • Loading branch information
tanishqmanuja committed Aug 3, 2024
0 parents commit fa9661c
Show file tree
Hide file tree
Showing 30 changed files with 1,063 additions and 0 deletions.
120 changes: 120 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
![Logo](https://raw.github.com/tanishqmanuja/apkmirror-downloader/v1/assets/banner.png?maxAge=2592000)

# APKMD //APK Mirror Downloader

[![Downloads][downloads-shield]][downloads-url]
[![NPM Version][npm-shield]][npm-url]
![GitHub Workflow Status][build-status-shield]
[![Language][language-shield]][language-url]
[![License][license-shield]][license-url]

APKMD is a CLI tool that allows you to download APKs from Apkmirror. This repo also provides a npm package [apkmirror-downloader](https://www.npmjs.com/package/apkmirror-downloader) that allows you to download APKs from APKMirror programatically.

## 🚀 Install

Using `npm`
```bash
npm install apkmirror-downloader
```

Using `bun`
```bash
bun add apkmirror-downloader
```

Or use any other package manager like `yarn` or `pnpm`

## 📃 Usage

```ts
import { APKMirrorDownloader } from "apkmirror-downloader";

const apkmd = new APKMirrorDownloader(
{ outDir: "./downloads" } // <-- 🟠 APKMDOptions (optional)
);

apkmd.download(
{ org: "google-inc", repo: "youtube" }, // <-- App (required)
{ type: "apk" } // <-- 🟣 AppOptions (optional), will be merged with APKMDOptions
);

// OR

APKMirrorDownloader.download({ org: "google-inc", repo: "youtube" });
```

🟠 **APKMDOptions Interface**
- arch: Optional. The architecture of the application. For example, arm64-v8a, armeabi-v7a, etc.
- dpi: Optional. The screen density of the application. For example, 240dpi, 320dpi, 480dpi, etc.
- outDir: Optional. The output directory where the application files will be stored.

🟣 **AppOptions Interface**
- version: Optional. The version of the application.
- arch: Optional, DEFAULT: "universal". The architecture of the application. For example, arm64-v8a, armeabi-v7a, etc.
- dpi: Optional, DEFAULT: "nodpi". The screen density of the application. For example, 240dpi, 320dpi, 480dpi, etc.
- type: Optional, DEFAULT: "apk". The type of the application. Supported types are "apk" and "bundle".
- outFile: Optional. The name of the output file where the application will be saved.
- outDir: Optional. The output directory where the application files will be stored.

`AppOptions` will be merged automatically with `APKMDOptions` when download function is called.

> [!WARNING]
> Sometimes, download can fail at random. This is most likely due to rate limit protection by APKMirror using Cloudflare.
## ⚡ CLI

CLI can be downloaded from [releases](https://github.com/tanishqmanuja/apkmirror-downloader/releases/latest) section.

Usage can be found using the following command

```bash
apkmd -h
```

For downloading multiple apks use apps.json file

```bash
apkmd apps.json
```

```json
{
"options": {
"arch": "arm64-v8a",
"outDir": "downloads"
},
"apps": [
{
"org": "google-inc",
"repo": "youtube-music",
"outFile": "ytm"
},
{
"org": "google-inc",
"repo": "youtube",
"outFile": "yt",
"version": "18.40.34"
}
]
}
```

## 🐱 Show your support

Give a ⭐️ if this project helped you!

## 💀 Disclaimer

THIS PROJECT IS NOT ASSOCIATED OR ENDORSED BY APKMIRROR. The project is provided "as is" without warranty of any kind, either express or implied. Use at your own risk.


<!-- Shields -->
[build-status-shield]: https://img.shields.io/github/actions/workflow/status/tanishqmanuja/apkmirror-downloader/ci.yaml?branch=main&style=for-the-badge
[downloads-shield]: https://img.shields.io/github/downloads/tanishqmanuja/apkmirror-downloader/total?style=for-the-badge&logo=github
[downloads-url]: https://github.com/tanishqmanuja/apkmirror-downloader/releases/latest
[language-shield]: https://img.shields.io/github/languages/top/tanishqmanuja/apkmirror-downloader?style=for-the-badge
[language-url]: https://www.typescriptlang.org/
[license-shield]: https://img.shields.io/github/license/tanishqmanuja/apkmirror-downloader?style=for-the-badge
[license-url]: https://github.com/tanishqmanuja/apkmirror-downloader/blob/main/LICENSE.md
[npm-shield]: https://img.shields.io/npm/v/apkmirror-downloader?style=for-the-badge
[npm-url]: https://www.npmjs.com/package/apkmirror-downloader
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches:
- main

pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
permissions:
contents: write

runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Dependencies
run: bun install --frozen-lockfile

- name: Lint
run: bun run lint
49 changes: 49 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
workflow_dispatch:
inputs:
bump:
description: "Bump Type"
required: true
type: choice
options:
- patch
- minor
- major

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
permissions:
contents: write

runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Git User
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Dependencies
run: bun install --frozen-lockfile

- name: Build and Release
run: bun run release ${{ github.event.inputs.bump }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# deps
node_modules

# output
dist
out
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ignore everything
/*

# Except
!.github
!src
!scripts
!.prettierrc
!tsconfig.json
!.release-it.json
16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"semi": true,
"tabWidth": 2,
"useTabs": false,
"printWidth": 80,
"singleQuote": false,
"arrowParens": "avoid",
"importOrder": [
"<BUILTIN_MODULES>",
"",
"<THIRD_PARTY_MODULES>",
"",
"^[./]"
],
"plugins": ["@ianvs/prettier-plugin-sort-imports"]
}
37 changes: 37 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"git": {
"tagName": "v${version}",
"commitMessage": "chore: release v${version}",
"pushRepo": "https://github.com/tanishqmanuja/apkmirror-downloader"
},
"hooks": {
"after:bump": ["bun run build", " bun run compile"]
},
"github": {
"release": true,
"releaseName": "vRYjs v${version}",
"tokenRef": "GITHUB_TOKEN",
"assets": ["out/*"]
},
"npm": {
"publish": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "🎉 Features"
},
{
"type": "fix",
"section": "🐛 Bug Fixes"
}
]
},
"ignoreRecommendedBump": true
}
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Tanishq Manuja

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# APKMD //APK Mirror Downloader

APKMD is a CLI tool that allows you to download APKs from Apkmirror. This repo also provides a npm package [apkmirror-downloader](https://www.npmjs.com/package/apkmirror-downloader) that allows you to download APKs from APKMirror programatically.

## 🚀 Install

Using `npm`
```bash
npm install apkmirror-downloader
```

Using `bun`
```bash
bun add apkmirror-downloader
```

Or use any other package manager like `yarn` or `pnpm`

## 📃 Usage

```ts
import { APKMirrorDownloader } from "apkmirror-downloader";

const apkmd = new APKMirrorDownloader(
{ outDir: "./downloads" } // <-- 🟠 APKMDOptions (optional)
);

apkmd.download(
{ org: "google-inc", repo: "youtube" }, // <-- App (required)
{ type: "apk" } // <-- 🟣 AppOptions (optional), will be merged with APKMDOptions
);

// OR

APKMirrorDownloader.download({ org: "google-inc", repo: "youtube" });
```

🟠 **APKMDOptions Interface**
- arch: Optional. The architecture of the application. For example, arm64-v8a, armeabi-v7a, etc.
- dpi: Optional. The screen density of the application. For example, 240dpi, 320dpi, 480dpi, etc.
- outDir: Optional. The output directory where the application files will be stored.

🟣 **AppOptions Interface**
- version: Optional. The version of the application.
- arch: Optional, DEFAULT: "universal". The architecture of the application. For example, arm64-v8a, armeabi-v7a, etc.
- dpi: Optional, DEFAULT: "nodpi". The screen density of the application. For example, 240dpi, 320dpi, 480dpi, etc.
- type: Optional, DEFAULT: "apk". The type of the application. Supported types are "apk" and "bundle".
- outFile: Optional. The name of the output file where the application will be saved.
- outDir: Optional. The output directory where the application files will be stored.

`AppOptions` will be merged automatically with `APKMDOptions` when download function is called.

## ⚡ CLI

CLI can be downloaded from [releases](https://github.com/tanishqmanuja/apkmirror-downloader/releases/latest) section.

Usage can be found using the following command

```bash
apkmd -h
```

For downloading multiple apks use apps.json file

```bash
apkmd apps.json
```

```json
{
"options": {
"arch": "arm64-v8a",
"outDir": "downloads"
},
"apps": [
{
"org": "google-inc",
"repo": "youtube-music",
"outFile": "ytm"
},
{
"org": "google-inc",
"repo": "youtube",
"outFile": "yt",
"version": "18.40.34"
}
]
}
```
Binary file added bun.lockb
Binary file not shown.
Loading

0 comments on commit fa9661c

Please sign in to comment.