Last active
February 6, 2018 13:46
-
-
Save przemoc/7513701 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Author
przemoc
commented
Feb 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment