#!/bin/sh | |
# SPDX-License-Identifier: MIT | |
## Copyright (C) 2013 Przemyslaw Pawelczyk <przemoc@gmail.com> | |
## | |
## This script is licensed under the terms of the MIT license. | |
## https://opensource.org/licenses/MIT | |
# | |
# Simple script for downloading program stored on CNET: | |
# - AOMEI Partition Assistant Standard | |
# Tested on 2013-11-17. | |
set -e | |
get_page() { curl -LsS "$1"; } | |
get_href() { sed '/'"$1"'/!d;s,.*<a href=",,;s,".*,,;q'; } | |
get_rurl() { sed '/.*<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/I!d;s,,,;s,".*,,;q'; } | |
strip_pq() { sed 's,.*/,,;s,?.*,,'; } | |
download() { curl -R "$1" -o "$2"; } | |
echo "Finding download link for AOMEI Partition Assistant Standard:" | |
HOMEPAGE="http://www.disk-partition.com/download-home.html" | |
echo "- $HOMEPAGE" | |
CNETPAGE="$(get_page "$HOMEPAGE" | get_href "Local Download Freeware")" | |
echo "- $CNETPAGE" | |
CNETLINK="$(get_page "$CNETPAGE" | get_href "Download Now")" | |
echo "- $CNETLINK" | |
CNETDURL="$(get_page "$CNETLINK" | get_rurl)" | |
echo "- $CNETDURL" | |
FILENAME="$(echo "$CNETDURL" | strip_pq)" | |
echo | |
echo "Downloading $FILENAME:" | |
download "$CNETDURL" "$FILENAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.