apksearch 1.3.0__py3-none-any.whl → 1.3.1__py3-none-any.whl

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/__init__.py CHANGED
@@ -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
  ]
apksearch/cli.py CHANGED
@@ -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
- return None
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]]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apksearch
3
- Version: 1.3.0
3
+ Version: 1.3.1
4
4
  Summary: Search for apks on varius websites
5
5
  Author-email: Abhi <allinoneallinone00@gmail.com>
6
6
  License: MIT License
@@ -1,18 +1,17 @@
1
- apksearch/__init__.py,sha256=QvfqsYdMwBGKWiCEnADT1E1m74n5jjjSnrzvasbbZcs,415
1
+ apksearch/__init__.py,sha256=06RpnjvNr-B_sXsF3O4KFqNr34A3UA0Gfyz426RffsA,365
2
2
  apksearch/__main__.py,sha256=MSmt_5Xg84uHqzTN38JwgseJK8rsJn_11A8WD99VtEo,61
3
- apksearch/cli.py,sha256=gpWmMXzcfGbLUnouSVUZzcxjP7ujWnf0sfqvdwkUIU8,10076
3
+ apksearch/cli.py,sha256=RIl40MRL3YQZ_4yQwFTaX11ujJtWy9s8H-wWfY6HRFU,8835
4
4
  apksearch/sites/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  apksearch/sites/apkad.py,sha256=x5nnI20Rj1LysZQc7-vFEbooxXb0vkmHzFpHoUvF_SA,4811
6
6
  apksearch/sites/apkcombo.py,sha256=AiJhSb0subQLb51dr8MQaxgeEZ77wI99InfigYfrcl4,4718
7
7
  apksearch/sites/apkfab.py,sha256=5f0fOBmQk0E30NcVE2cF80soJqI5ziOukU6_xMPtgFQ,5502
8
8
  apksearch/sites/apkmirror.py,sha256=IpS6r7ovM3g2dZrkR_a9zQpHy-jqrU2nJ3ykVkWxers,3127
9
- apksearch/sites/apkmonk.py,sha256=85bidRBz6RfZOaS9WEZfTXGnrMVsJEstMJT10XltWus,4657
10
- apksearch/sites/apkpure.py,sha256=iXZPzecdBy8JlJmC_yFCQrPi3hXnulRbqg7xCSd3Ppk,8975
9
+ apksearch/sites/apkpure.py,sha256=YrM3uA1abrVWObG_Dzk2pMH9VBAsBCpZYgPGEF--7eU,8923
11
10
  apksearch/sites/appteka.py,sha256=in04JYF043n0fUvBW1QQeXnNbYekGUIh4qeame951nA,6372
12
11
  apksearch/sites/aptoide.py,sha256=5RruPDwyo5z0E2XesX4Mi41ONdn26SxN0dH36eRolNQ,4816
13
- apksearch-1.3.0.dist-info/licenses/LICENSE,sha256=Icu9iAY9cAaraq-HaAk8aWpXS1nE-3U_wfaOhN-HQUw,1061
14
- apksearch-1.3.0.dist-info/METADATA,sha256=FXDYFNkHiFEupZa-Y7II6pla6inP8cF6oAjHpUlB_IA,8230
15
- apksearch-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- apksearch-1.3.0.dist-info/entry_points.txt,sha256=FeAPgNPSU1tCwQNaKAmk6eQYbMHtsltcgeWSGUTxu0k,49
17
- apksearch-1.3.0.dist-info/top_level.txt,sha256=VguZMODhlXWwDyJJNJms5syJ4EHmWSQOS45J9I5Cv5o,10
18
- apksearch-1.3.0.dist-info/RECORD,,
12
+ apksearch-1.3.1.dist-info/licenses/LICENSE,sha256=Icu9iAY9cAaraq-HaAk8aWpXS1nE-3U_wfaOhN-HQUw,1061
13
+ apksearch-1.3.1.dist-info/METADATA,sha256=y5FIlmIjoIO2jTxYljjwCwB1QSAhIneyK09Vn-a7toI,8230
14
+ apksearch-1.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ apksearch-1.3.1.dist-info/entry_points.txt,sha256=FeAPgNPSU1tCwQNaKAmk6eQYbMHtsltcgeWSGUTxu0k,49
16
+ apksearch-1.3.1.dist-info/top_level.txt,sha256=VguZMODhlXWwDyJJNJms5syJ4EHmWSQOS45J9I5Cv5o,10
17
+ apksearch-1.3.1.dist-info/RECORD,,
@@ -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