Last active
December 3, 2024 14:05
-
-
Save Winding6636/a3349e796aa83343c7330f97b62e4113 to your computer and use it in GitHub Desktop.
[Doesn't work ARCHIVE] DLsite Product Download Script / OpeEnv: WSL1 WSL2 ArchLinux
This file contains hidden or 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 | |
# DLsite Product Downloader | |
source .session > /dev/null 2>&1 | |
function sessionchk() { | |
result=`curl -L -sS "https://ssl.dlsite.com/maniax/mypage" -H 'authority: www.dlsite.com' -H "cookie: AuthCookie="$AuthCookie"; __DLsite_SID="$DSID";" --compressed | grep -oP '(?<=<title>)(.+)(?=</title)'` | |
if [[ $result == "新規登録 - 新規登録" ]] ; then | |
echo :-: 認証エラー :-: | |
return 1 | |
else | |
return 0 | |
fi | |
} | |
function parser() { | |
IFS_=$IFS | |
IFS=$1 | |
array=($2) | |
IFS=$IFS_ | |
} | |
sessionchk | |
if [ $? == 1 ]; then | |
echo DLsite Session Cookie が切れています。 | |
read -p "Please DLsite AuthCookie: " AuthCookie | |
echo "declare -x AuthCookie=$AuthCookie" > .session | |
read -p "Please DLsite __DLsite_SID: " DSID | |
echo "declare -x DSID=$DSID" >> .session | |
fi | |
echo -e "\n:-: DLsite_ProductsDownload :-:\n" | |
if [ -e $1 ]; then | |
read -p "RJCode: (ex. RJ114514) " RJNUM | |
else | |
RJNUM=$1 | |
fi | |
url="$(echo $RJNUM | grep :// | sed -e's,^\(.*://\).*,\1,g')" | |
host="$(echo ${RJNUM/$url/} | cut -d/ -f1| sed -e 's,:.*,,g')" | |
if [ -n "$url" -a -n "$host" ]; then | |
if [ $host == "www.dlsite.com" ]; then | |
path="$(echo $RJNUM | grep / | cut -d/ -f2-)" | |
RJNUM="$(echo $path | grep -oP "(?<=product_id/)(RJ)(.+)(?=.html)")" | |
fi | |
fi | |
if [[ $RJNUM =~ ^[RJ]+([0-9]+).*$ ]]; then | |
echo -e "Product_id: $RJNUM \n" | |
else | |
echo "🤔 :thinking_face: 🤔" | |
exit 1 | |
fi | |
for _3FIGURE in `seq -f %01g 0 30` | |
do | |
#echo "${_3FIGURE}" | |
echo Download Request... | |
URL="https://www.dlsite.com/maniax/download/=/number/${_3FIGURE}/product_id/$RJNUM.html" | |
result=`curl -L -sS $URL -H 'authority: www.dlsite.com' -H "referer: https://www.dlsite.com/maniax/download/split/=/product_id/$RJNUM.html" -H "cookie: AuthCookie="$AuthCookie"; __DLsite_SID="$DSID";" --compressed | grep -oP '(?<= <pre class="detail-text">)(.+)(?=</pre>)'` | |
if [ -z "$result" -a "${_3FIGURE}" -gt 0 ]; then | |
echo -e "download key notfound. \n:-: Download END :-:" | |
break | |
elif [ -n "$result" ]; then | |
parser / $result | |
SAVE=${array[12]} | |
echo Download... $URL | |
sleep 2 | |
if [ "${_3FIGURE}" = "0" ]; then | |
curl -# -L "$result" -H 'authority: www.dlsite.com' -H "referer: https://www.dlsite.com/maniax/download/split/=/product_id/$RJNUM.html" -H "cookie: AuthCookie="$AuthCookie"; __DLsite_SID="$DSID";" --compressed --output $SAVE && saves+=($SAVE) | |
elif [ ${_3FIGURE} -gt 0 ]; then | |
curl -# -L "$result" -H 'authority: www.dlsite.com' -H "referer: https://www.dlsite.com/maniax/download/split/=/product_id/$RJNUM.html" -H "cookie: AuthCookie="$AuthCookie"; __DLsite_SID="$DSID";" --compressed --output $SAVE && saves+=($SAVE) | |
fi | |
sleep 3 | |
fi | |
done | |
if [ -n "${saves[0]}" ]; then | |
echo -e "\n:-: 保存しました。:-:\n" | |
echo -e " ${saves[@]} \n" | |
echo ":-: このまま自動展開を行います。:-: \(unrar or unar を使います。\)" | |
parser . ${saves[0]} | |
extdir=${array[0]} | |
if [ "${array[2]}" = "exe" -o "${array[2]}" = "rar" ]; then | |
echo ":-: 展開中... :-:" | |
unrar x ./${saves[0]} extract/$extdir/ -y | tail -1 && extres=$? | |
else | |
echo ":-: 展開中... :-:" | |
unar -f -o ./extract/$extdir ./${saves[0]} | tail -1 && extres=$? | |
fi | |
if [ -f /proc/sys/fs/binfmt_misc/WSLInterop ]; then | |
if [ -d ./extract/$extdir ]; then explorer.exe `wslpath -w ./extract/$extdir` ;fi | |
fi | |
for file in ${saves[@]}; do mv $file ./extract/ >/dev/null 2>&1 ;done | |
if [ "$extres" = 0 ]; then | |
echo -e ":-: DLsiteダウンロード展開処理完了 :-:" | |
exit 0 | |
else | |
echo -e ":-: 正常に完了しませんでした。 :-:" | |
exit 1 | |
fi | |
else | |
echo -e ":-: 保存されませんでした。:-:" | |
exit 1 | |
fi |
Sorry.
This is no longer maintained.
The specifications have changed and it can no longer be used.
Alternative: https://github.com/AcrylicShrimp/dlsite-manager
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how does this work lmfao