Last active
November 3, 2024 17:19
-
-
Save eggplants/8d8e5e14b62ab5759b4ab6bb98f21217 to your computer and use it in GitHub Desktop.
DLsiteの分割ダウンロードが遅いのでAPIを完全に理解してaria2で落とせるように
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
#!/usr/bin/env -S pipx run | |
# DLsiteの分割ダウンロードが遅いのでAPIを完全に理解してaria2で落とせるように | |
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "requests", | |
# ] | |
# /// | |
import requests | |
N = 5 | |
WORK_ID = "RJ..." | |
JWT = "..." | |
SID = "..." | |
session = requests.session() | |
session.cookies.set("jwt", JWT, domain=".dlsite.com") | |
session.cookies.set("__DLsite_SID", SID, domain=".dlsite.com") | |
for i in range(N): | |
res = session.get( | |
f"https://www.dlsite.com/maniax/download/=/number/{i + 1}/product_id/{WORK_ID}.html", | |
allow_redirects=False | |
) | |
loc = res.headers.get('Location') | |
cookie = "; ".join([ | |
f"{k}={v}" for k, v in session.cookies.get_dict().items() | |
] | |
print("aria2c -x5 --header='cookie: {cookie}' '{loc}'") |
Author
eggplants
commented
Mar 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment