Last active
March 18, 2022 13:21
-
-
Save yshalsager/dbb516cab80afa7753054267db801cb9 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/bash | |
# Scrapes mp3 files links from audio.islamweb.com links into csv data: url, filename | |
function islamweb_get_mp3() { | |
URL=$1 | |
PAGES="${2:-1}" | |
for page in $(seq 1 $PAGES); do | |
case $URL in | |
*pageno=*) | |
URL=$(echo $URL | sed "s|pageno=[0-9]\+|pageno=$page|g");; | |
*) | |
URL=$(echo $URL | sed "s|page=|pageno=$page\&page=|g");; | |
esac | |
echo "$page" && echo "$URL" | |
curl -s "$URL" | grep -Po "<a url='(https.*mp3)' title_data=\"(.*)\" id_data=\"" | sed -e "s|<a url='||g" -e "s|' title_data=\"|,|g" -e 's|" id_data="|.mp3|g'; | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment