apksearch 1.3.0__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apksearch-1.3.0 → apksearch-1.3.1}/PKG-INFO +1 -1
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/__init__.py +0 -2
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/cli.py +0 -29
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/apkpure.py +8 -9
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch.egg-info/PKG-INFO +1 -1
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch.egg-info/SOURCES.txt +0 -1
- {apksearch-1.3.0 → apksearch-1.3.1}/pyproject.toml +1 -1
- apksearch-1.3.0/apksearch/sites/apkmonk.py +0 -108
- {apksearch-1.3.0 → apksearch-1.3.1}/LICENSE +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/README.md +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/__main__.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/__init__.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/apkad.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/apkcombo.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/apkfab.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/apkmirror.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/appteka.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch/sites/aptoide.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch.egg-info/dependency_links.txt +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch.egg-info/entry_points.txt +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch.egg-info/requires.txt +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/apksearch.egg-info/top_level.txt +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/setup.cfg +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/tests/test_apkfab.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/tests/test_apkmirror.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/tests/test_apkpure.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/tests/test_appteka.py +0 -0
- {apksearch-1.3.0 → apksearch-1.3.1}/tests/test_aptoide.py +0 -0
@@ -5,7 +5,6 @@ from .sites.apkcombo import APKCombo
|
|
5
5
|
from .sites.apkfab import APKFab
|
6
6
|
from .sites.apkad import APKad
|
7
7
|
from .sites.aptoide import Aptoide
|
8
|
-
from .sites.apkmonk import APKMonk
|
9
8
|
|
10
9
|
__all__ = [
|
11
10
|
"APKPure",
|
@@ -15,5 +14,4 @@ __all__ = [
|
|
15
14
|
"APKFab",
|
16
15
|
"APKad",
|
17
16
|
"Aptoide",
|
18
|
-
"APKMonk",
|
19
17
|
]
|
@@ -9,7 +9,6 @@ from apksearch import (
|
|
9
9
|
APKFab,
|
10
10
|
APKad,
|
11
11
|
Aptoide,
|
12
|
-
APKMonk,
|
13
12
|
)
|
14
13
|
from requests.exceptions import ConnectionError, ConnectTimeout
|
15
14
|
|
@@ -200,32 +199,6 @@ def search_aptoide(pkg_name: str, version: str | None) -> None:
|
|
200
199
|
print(f"{BOLD}Aptoide:{NC} No Results!")
|
201
200
|
|
202
201
|
|
203
|
-
def search_apkmonk(pkg_name: str, version: str | None) -> None:
|
204
|
-
apkmonk = APKMonk(pkg_name)
|
205
|
-
try:
|
206
|
-
result_apkmonk: tuple[str, str] | None = apkmonk.search_apk()
|
207
|
-
except (ConnectionError, ConnectTimeout):
|
208
|
-
result_apkmonk = None
|
209
|
-
print(f"{RED}Failed to resolve 'apkmonk.com'!{NC}")
|
210
|
-
if result_apkmonk:
|
211
|
-
title, apk_link = result_apkmonk
|
212
|
-
print(f"{BOLD}APKMonk:{NC} Found {GREEN}{title}{NC}") if title else None
|
213
|
-
print(f" ╰─> {BOLD}Link: {YELLOW}{apk_link}{NC}") if not version else None
|
214
|
-
if version:
|
215
|
-
versions: list[tuple[str, str]] = apkmonk.find_versions(apk_link)
|
216
|
-
if versions:
|
217
|
-
for version_tuple in versions:
|
218
|
-
if version_tuple[0] == version:
|
219
|
-
print(
|
220
|
-
f" ╰─> {BOLD}Version: {GREEN}{version}{NC} - {YELLOW}{version_tuple[1]}{NC}"
|
221
|
-
)
|
222
|
-
break
|
223
|
-
else:
|
224
|
-
print(f"{BOLD}APKMonk:{NC} Version {RED}{version}{NC} not found!")
|
225
|
-
else:
|
226
|
-
print(f"{BOLD}APKMonk:{NC} No Results!")
|
227
|
-
|
228
|
-
|
229
202
|
def main():
|
230
203
|
parser = argparse.ArgumentParser(
|
231
204
|
prog="APKSearch", description="Search for APKs on various websites"
|
@@ -255,8 +228,6 @@ def main():
|
|
255
228
|
search(search_apkfab, pkg_name, version, log_err)
|
256
229
|
# Initiate search on apkad
|
257
230
|
search(search_apkad, pkg_name, version, log_err)
|
258
|
-
# Initiate search on apmonk
|
259
|
-
search(search_apkmonk, pkg_name, version, log_err)
|
260
231
|
|
261
232
|
|
262
233
|
if __name__ == "__main__":
|
@@ -107,14 +107,6 @@ class APKPure:
|
|
107
107
|
None: If no matching APK is found.
|
108
108
|
tuple[str, str]: A tuple containing the title and link of the matching APK if found.
|
109
109
|
"""
|
110
|
-
# Try API first
|
111
|
-
api_result = self._api_search()
|
112
|
-
if api_result:
|
113
|
-
title, versions = api_result
|
114
|
-
if versions:
|
115
|
-
return title, versions[0][1]
|
116
|
-
|
117
|
-
# Fall back to web scrapping
|
118
110
|
pkg_name = self.pkg_name
|
119
111
|
url = self.search_url + pkg_name
|
120
112
|
response: requests.Response = self.session.get(url, headers=self.headers)
|
@@ -138,7 +130,7 @@ class APKPure:
|
|
138
130
|
try:
|
139
131
|
location = response.headers.get("Location")
|
140
132
|
except AttributeError:
|
141
|
-
|
133
|
+
location = None
|
142
134
|
if location:
|
143
135
|
if location == "https://apkpure.com":
|
144
136
|
return None
|
@@ -152,6 +144,13 @@ class APKPure:
|
|
152
144
|
if content:
|
153
145
|
apk_title = content.split("filename=")[1].strip('"').split("_")[0]
|
154
146
|
return apk_title, location
|
147
|
+
|
148
|
+
api_result = self._api_search()
|
149
|
+
if api_result:
|
150
|
+
title, versions = api_result
|
151
|
+
if versions:
|
152
|
+
return title, versions[0][1]
|
153
|
+
|
155
154
|
return None
|
156
155
|
|
157
156
|
def find_versions(self, apk_link: str) -> list[tuple[str, str]]:
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "apksearch"
|
7
|
-
version = "1.3.
|
7
|
+
version = "1.3.1"
|
8
8
|
description = "Search for apks on varius websites"
|
9
9
|
authors = [{ name = "Abhi", email = "allinoneallinone00@gmail.com" }]
|
10
10
|
license = { file = "LICENSE" }
|
@@ -1,108 +0,0 @@
|
|
1
|
-
import re
|
2
|
-
import requests
|
3
|
-
from bs4 import BeautifulSoup
|
4
|
-
|
5
|
-
|
6
|
-
class APKMonk:
|
7
|
-
"""
|
8
|
-
This class provides methods to search for an APK on APKMonk based on package name,
|
9
|
-
and to find available versions and their download links for a given APK link.
|
10
|
-
|
11
|
-
Parameters:
|
12
|
-
pkg_name (str): The package name of the APK to search for.
|
13
|
-
|
14
|
-
Attributes:
|
15
|
-
pkg_name (str): The package name of the APK to search for.
|
16
|
-
base_url (str): The base URL of the APKMonk website.
|
17
|
-
search_url (str): The URL used to search for APKs on APKMonk.
|
18
|
-
headers (dict): The headers used for making HTTP requests.
|
19
|
-
session (requests.Session): The session object used for making HTTP requests.
|
20
|
-
|
21
|
-
Methods:
|
22
|
-
search_apk() -> None | tuple[str, str]:
|
23
|
-
Searches for the APK on APKMonk and returns the title and link if found.
|
24
|
-
|
25
|
-
find_versions(apk_link: str) -> list[tuple[str, str]]:
|
26
|
-
Finds and returns a list of versions and their download links for the given APK link.
|
27
|
-
"""
|
28
|
-
|
29
|
-
def __init__(self, pkg_name: str):
|
30
|
-
self.pkg_name = pkg_name
|
31
|
-
self.base_url = "https://www.apkmonk.com"
|
32
|
-
self.search_url = self.base_url + "/ssearch?q="
|
33
|
-
self.headers = {
|
34
|
-
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
35
|
-
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
|
36
|
-
"cache-control": "no-cache",
|
37
|
-
"dnt": "1",
|
38
|
-
"pragma": "no-cache",
|
39
|
-
"priority": "u=0, i",
|
40
|
-
"referer": "https://www.apkmonk.com/",
|
41
|
-
"sec-ch-ua": '"Microsoft Edge";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
|
42
|
-
"sec-ch-ua-mobile": "?0",
|
43
|
-
"sec-ch-ua-platform": '"Windows"',
|
44
|
-
"sec-fetch-dest": "document",
|
45
|
-
"sec-fetch-mode": "navigate",
|
46
|
-
"sec-fetch-site": "same-origin",
|
47
|
-
"sec-fetch-user": "?1",
|
48
|
-
"upgrade-insecure-requests": "1",
|
49
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0",
|
50
|
-
}
|
51
|
-
self.session = requests.Session()
|
52
|
-
|
53
|
-
def search_apk(self) -> None | tuple[str, str]:
|
54
|
-
"""
|
55
|
-
Searches for the APK on APKMonk and returns the title and link if found.
|
56
|
-
|
57
|
-
Returns:
|
58
|
-
None: If no matching APK is found.
|
59
|
-
tuple[str, str]: A tuple containing the title and link of the matching APK if found.
|
60
|
-
"""
|
61
|
-
pkg_name = self.pkg_name
|
62
|
-
url = self.search_url + pkg_name
|
63
|
-
response: requests.Response = self.session.get(url, headers=self.headers)
|
64
|
-
soup = BeautifulSoup(response.text, "html.parser")
|
65
|
-
search_results = soup.find("a", {"title": re.compile(".*apk$")})
|
66
|
-
if search_results:
|
67
|
-
link = search_results["href"]
|
68
|
-
title = search_results.find("span", {"class": "af-title truncate"}).text
|
69
|
-
if link == f"/app/{pkg_name}/":
|
70
|
-
return title, f"{self.base_url}{link}"
|
71
|
-
return None
|
72
|
-
|
73
|
-
def find_versions(self, apk_link: str) -> list[tuple[str, str]]:
|
74
|
-
"""
|
75
|
-
Finds and returns a list of versions and their download links for the given APK link.
|
76
|
-
|
77
|
-
Parameters:
|
78
|
-
apk_link (str): The link to the APK on the APKMonk website.
|
79
|
-
|
80
|
-
Returns:
|
81
|
-
list[tuple[str, str]]: A list of tuples, where each tuple contains the version number
|
82
|
-
and its corresponding download link. If no versions are found, an empty list is returned.
|
83
|
-
"""
|
84
|
-
versions_info = []
|
85
|
-
if apk_link.startswith(self.base_url):
|
86
|
-
url = apk_link
|
87
|
-
response: requests.Response = self.session.get(url, headers=self.headers)
|
88
|
-
soup = BeautifulSoup(response.text, "html.parser")
|
89
|
-
|
90
|
-
version_header = soup.find(
|
91
|
-
"div",
|
92
|
-
{"class": "box-title"},
|
93
|
-
text=re.compile("All Versions", re.IGNORECASE),
|
94
|
-
)
|
95
|
-
|
96
|
-
if version_header:
|
97
|
-
versions_table = version_header.find_next("table", {"class": "striped"})
|
98
|
-
|
99
|
-
if versions_table:
|
100
|
-
rows = versions_table.find_all("tr")
|
101
|
-
for row in rows:
|
102
|
-
version_link = row.find("a", href=True)
|
103
|
-
if version_link:
|
104
|
-
version_number = version_link.text.strip()
|
105
|
-
download_url = self.base_url + version_link["href"]
|
106
|
-
versions_info.append((version_number, download_url))
|
107
|
-
|
108
|
-
return versions_info
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|