mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
'Refactored by Sourcery'
This commit is contained in:
+17
-19
@@ -59,11 +59,9 @@ def apkmirror_scrapper(package_name: str) -> str:
|
||||
# regular expression pattern to match w=xx&h=xx&q=xx
|
||||
pattern = r"(w=\d+&h=\d+&q=\d+)"
|
||||
|
||||
# Replace the matched patterns with the new dimensions and q value
|
||||
apk_mirror_url = apk_mirror_base_url + re.sub(
|
||||
return apk_mirror_base_url + re.sub(
|
||||
pattern, f"w={new_width}&h={new_height}&q={new_quality}", sub_url
|
||||
)
|
||||
return apk_mirror_url
|
||||
raise APKMirrorScrapperFailure()
|
||||
|
||||
|
||||
@@ -88,12 +86,13 @@ def gplay_icon_scrapper(package_name: str) -> str:
|
||||
|
||||
def generate_markdown_table(data: List[List[str]]) -> str:
|
||||
"""Generate table."""
|
||||
if len(data) == 0:
|
||||
if not data:
|
||||
return "No data to generate table."
|
||||
|
||||
table = "| Package Name | App Icon | PlayStore link | APKMirror link|APKCombo Link| Supported?|\n"
|
||||
table += "|-------------|----------|----------------|---------------|------------------|----------|\n"
|
||||
|
||||
table = (
|
||||
"| Package Name | App Icon | PlayStore link | APKMirror link|APKCombo Link| Supported?|\n"
|
||||
+ "|-------------|----------|----------------|---------------|------------------|----------|\n"
|
||||
)
|
||||
for row in data:
|
||||
if len(row) != 6:
|
||||
raise ValueError("Each row must contain 4 columns of data.")
|
||||
@@ -119,18 +118,17 @@ def main() -> None:
|
||||
supported_app = set(Patches.support_app().keys())
|
||||
missing_support = sorted(possible_apps.difference(supported_app))
|
||||
output = "New app found which aren't supported or outdated.\n\n"
|
||||
data = []
|
||||
for index, app in enumerate(missing_support):
|
||||
data.append(
|
||||
[
|
||||
app,
|
||||
f'<img src="{gplay_icon_scrapper(app)}" width=50 height=50>',
|
||||
f"[PlayStore Link](https://play.google.com/store/apps/details?id={app})",
|
||||
f"[APKMirror Link](https://www.apkmirror.com/?s={app})",
|
||||
f"[APKCombo Link](https://apkcombo.com/genericApp/{app})",
|
||||
"<li>- [ ] </li>",
|
||||
]
|
||||
)
|
||||
data = [
|
||||
[
|
||||
app,
|
||||
f'<img src="{gplay_icon_scrapper(app)}" width=50 height=50>',
|
||||
f"[PlayStore Link](https://play.google.com/store/apps/details?id={app})",
|
||||
f"[APKMirror Link](https://www.apkmirror.com/?s={app})",
|
||||
f"[APKCombo Link](https://apkcombo.com/genericApp/{app})",
|
||||
"<li>- [ ] </li>",
|
||||
]
|
||||
for app in missing_support
|
||||
]
|
||||
table = generate_markdown_table(data)
|
||||
output += table
|
||||
with open("status.md", "w", encoding="utf_8") as status:
|
||||
|
||||
Reference in New Issue
Block a user