diff options
author | NeodarZ <neodarz@neodarz.ovh> | 2016-12-02 17:56:32 +0100 |
---|---|---|
committer | NeodarZ <neodarz@neodarz.ovh> | 2016-12-02 17:56:32 +0100 |
commit | 6eed18304fe27b19ca5ec65ce712142fe0d78ae6 (patch) | |
tree | 0e4f480a2380e498ad2b65fe5e2784afd318a2bd | |
download | thasearch.sh-6eed18304fe27b19ca5ec65ce712142fe0d78ae6.tar.xz thasearch.sh-6eed18304fe27b19ca5ec65ce712142fe0d78ae6.zip |
initial release
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | THASearch.sh | 27 |
2 files changed, 30 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ec5982 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# THASearch.sh + +This is juste a simple script to get download links of the website [modarchive.org](https://modarchive.org/). diff --git a/THASearch.sh b/THASearch.sh new file mode 100755 index 0000000..f5f68b5 --- /dev/null +++ b/THASearch.sh @@ -0,0 +1,27 @@ +#!/bin/bash +if [[ $1 != "" ]];then + curl -s "http://modarchive.org/index.php?request=search&query=$1&submit=Find&search_type=filename_or_songtitle" > .list + number_of_page=$(cat .list | grep -i ">[0-9]</option>$" | rev | cut -d'<' -f2 | cut -d'>' -f1 | sed -n '1p') + + if [[ $number_of_page != "" ]];then + for ((i=1; i <= $number_of_page; i++ )) + do + if [[ $i != "1" ]];then + curl -s "http://modarchive.org/index.php?request=search&query=chiptune&submit=Find&search_type=filename_or_songtitle&page="$i"#mods" > .list + fi + while IFS='' read -r line || [[ -n "$line" ]]; do + if [[ $line =~ "downloads.php" ]];then + line=$(echo $line | grep "downloads.php" | awk '{print $9}' | cut -d'"' -f2 | cut -d'"' -f1) + echo $line + fi + done < ".list" + done + else + echo "not found" + fi + rm .list +else + echo "Usage : TMASearch.sh <search_query>" +fi + + |