NicolasWebDev / reinstall-magisk-on-lineageos

Small bash script to reinstall magisk after each LineageOS update
72 stars 15 forks source link

Site change on download.lineageos.org breaks get_build_url #38

Closed dwildstr closed 1 year ago

dwildstr commented 1 year ago

Trying to run this script today, get_build_url produced no text, predictably causing download_latest_lineageos_build to fail. The problem seems to be that pages on download.lineageos.org have been refactored to use client-side javascript more extensively, no longer including download URLs directly in the page source.

I changed get_build_url to rely on the (hopefully less prone to breakage) API; changes are below. Note this will add a dependency on the jq JSON parser.

I replaced the code for get_build_url() and get_device_downloads_page() with the following:

get_device_downloads_page_json() {
    echo "https://download.lineageos.org/api/v2/devices/$(get_device_name)/builds"
}

get_build_url() {
    curl --no-progress-meter "$(get_device_downloads_page_json)" |
    jq '.[] | .files[0].url ' |
    grep --only-matching --ignore-case \
            "https://mirrorbits.lineageos.org/[^\"]*"$(
            )"$(get_lineage_version)-signed.zip"
}
dwildstr commented 1 year ago

Never mind. Apparently I had an old build; I see this has already been fixed.