Skip to content

Commit

Permalink
another ios change
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrErde committed Jun 24, 2024
1 parent 67e21e3 commit dcb6f58
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
python script/fetch_outfits.py
- name: Get latest Apk
run: python script/down-ipa.py ${{steps.var.outputs.version}}
run: python script/down-ipa.py ${{steps.var.outputs.version}} ${{ secrets.SESSION }}

- name: Unpack apk
run: python misc/unpack-ipa.py ${{steps.var.outputs.version}}
Expand Down
33 changes: 27 additions & 6 deletions all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@
import time
import glob
import argparse
import browser_cookie3


def get_session():
# Retrieve Firefox cookies
cookies = browser_cookie3.firefox()

# Filter for cookies from "armconverter.com"
armconverter_cookies = [
cookie for cookie in cookies if "armconverter.com" in cookie.domain
]

# Filter for session cookies
session_cookies = [cookie for cookie in armconverter_cookies if not cookie.expires]

# Return the session cookies values
session_cookie_values = [cookie.value for cookie in session_cookies]

# Print the session cookies values
for value in session_cookie_values:
print(value)

return session_cookie_values


def version():
Expand All @@ -27,12 +50,9 @@ def version():
rm_dir = ["upload", "gamedata"]


def get_scripts(type, version):
def get_scripts(type, version, session):
return [
["script/fetch_links.py"],
["script/fetch_profile.py"],
["script/fetch_outfits.py"],
[f"script/down-{type}.py", version],
[f"script/down-{type}.py", version, session[0]],
[f"misc/unpack-{type}.py", version],
["script/fetch_characters.py"],
["script/fetch_boards.py"],
Expand Down Expand Up @@ -68,7 +88,8 @@ def cleanup():


def run_scripts(type, version):
scripts = get_scripts(type, version)
session = get_session()
scripts = get_scripts(type, version, session)
try:
print(f"Choosing type {type}")
print(f"Choosing version {version}")
Expand Down
149 changes: 131 additions & 18 deletions script/down-ipa.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import browser_cookie3
import sys
import re
import requests
Expand All @@ -9,34 +10,146 @@
)
sys.exit(1)

version = sys.argv[1]
session = sys.argv[2]

appVer = sys.argv[1]


if not re.match(r"^\d{1,2}-\d{1,2}-\d{1,2}$", appVer):
if not re.match(r"^\d{1,2}-\d{1,2}-\d{1,2}$", version):
print(
"Error: Invalid version format. Please use the format 'X-Y-Z' (e.g., '3-12-2')."
)
exit(1)

appver = version.replace("-", ".")

appVer = appVer.replace("-", ".")
appid = 512939461
apppackage = "com.kiloo.subwaysurfers"
user_agent = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0"
)
appName = "subwaysurfers"

userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
version_url = (
f"https://armconverter.com/decryptedappstore/versions/{appid}/{appver}?country=us"
)
prepare_url = f"https://armconverter.com/decryptedappstore/download/{appid}/{apppackage}/{appver}/prepare"
download_base_url = f"https://armconverter.com/decryptedappstore/download/{appid}/{apppackage}/{appver}"
info_url = f"https://armconverter.com/decryptedappstore/download/{appid}/{apppackage}/{appver}/info"
"""
def get_session():
# Retrieve Firefox cookies
cookies = browser_cookie3.firefox()
appName = "subwaysurfers"
# Filter for cookies from "armconverter.com"
armconverter_cookies = [
cookie for cookie in cookies if "armconverter.com" in cookie.domain
]
url = f"https://dl.iosvizor.net/subway-surfers/Subway-Surfers-v{appVer}-iosvizor.ipa"
# Filter for session cookies
session_cookies = [cookie for cookie in armconverter_cookies if not cookie.expires]
response = requests.get(url, headers={"User-Agent": userAgent})
# Return the session cookies values
session_cookie_values = [cookie.value for cookie in session_cookies]
appVer = appVer.replace(".", "-")
# Print the session cookies values
for value in session_cookie_values:
print(value)
if response.status_code == 200:
with open(f"{appName}-{appVer}.ipa", "wb") as f:
f.write(response.content)
print(f"Downloaded {appName} version {appVer} successfully.")
else:
print(
f"Failed to download {appName} version {appVer}. HTTP status code: {response.status_code}"
)
return session_cookie_values
"""

def user(session):
# Set up the URLs and headers
url = f"https://armconverter.com/decryptedappstore/user/info"

headers = {"Cookie": f"session={session}"}

# Initial POST request to check state and versions
response = requests.post(url, headers=headers)
data = response.json()

# Check if the versions list is present and get the last version
quota = data.get("quota", [])
lastLogin = data.get("lastLogin", [])


def check_version(session, version):
headers = {"Cookie": f"session={session}", "User-Agent": user_agent}

# Initial GET request to check state and versions
response = requests.get(version_url, headers=headers)

if response.status_code != 200:
print(f"Error fetching version information: {response.status_code}")
return

data = response.json()

# Check if the versions list is present and get the last version
versions = data.get("versions", [])

if not versions:
print("No versions found.")
return

# Extract the version number from the last version dictionary
last_version = versions[-1].get("ver").replace(".", "-")

# Compare the last version with the provided version
if last_version != version:
print(f"The last version {last_version} does not match version {version}.")
else:
print(f"You are using the latest version {version}.")


def download(session, version):

headers = {
"User-Agent": user_agent,
"Referer": "https://armconverter.com/decryptedappstore/us/Subway",
"Cookie": f"session={session}",
}

try:
# POST request to prepare download
response = requests.post(prepare_url, headers=headers)
data = response.json()

if data.get("state") == "ready":
token = data.get("token")

if not token:
print("Token not found.")
return

# Final download URL with token
download_url = f"{download_base_url}?token={token}"
download_response = requests.get(download_url, headers=headers)

if download_response.status_code == 200:
with open(f"{appName}-{version}.ipa", "wb") as file:
file.write(download_response.content)
print("File downloaded successfully.")
else:
print("Failed to download the file.")
else:
print("State is not ready.")
sys.exit(1)

except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")


def main():
# session = get_session()
# session = session[0]

if session:
check_version(session, version)
download(session, version)
else:
print("No session cookies found.")
sys.exit(1)


if __name__ == "__main__":
main()
42 changes: 42 additions & 0 deletions script/down-ipa_iosvizor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import sys
import re
import requests


if len(sys.argv) < 2:
print(
"Error: Invalid version format. Please use the format 'X-Y-Z' (e.g., '3-12-2')."
)
sys.exit(1)


appVer = sys.argv[1]


if not re.match(r"^\d{1,2}-\d{1,2}-\d{1,2}$", appVer):
print(
"Error: Invalid version format. Please use the format 'X-Y-Z' (e.g., '3-12-2')."
)
exit(1)


appVer = appVer.replace("-", ".")

userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"

appName = "subwaysurfers"

url = f"https://dl.iosvizor.net/subway-surfers/Subway-Surfers-v{appVer}-iosvizor.ipa"

response = requests.get(url, headers={"User-Agent": userAgent})

appVer = appVer.replace(".", "-")

if response.status_code == 200:
with open(f"{appName}-{appVer}.ipa", "wb") as f:
f.write(response.content)
print(f"Downloaded {appName} version {appVer} successfully.")
else:
print(
f"Failed to download {appName} version {appVer}. HTTP status code: {response.status_code}"
)

0 comments on commit dcb6f58

Please sign in to comment.