Skip to content

Instantly share code, notes, and snippets.

@eggplants
Created March 6, 2024 17:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eggplants/06e079f9a398cc5b03d8d80caeb47741 to your computer and use it in GitHub Desktop.
Save eggplants/06e079f9a398cc5b03d8d80caeb47741 to your computer and use it in GitHub Desktop.
DLsiteの分割ダウンロードが遅いのでAPIをみてaria2で落とす情報を収集
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(f"aria2c -x5 --header='cookie: {cookie}' '{loc}'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment