Created
March 6, 2024 17:15
-
-
Save eggplants/06e079f9a398cc5b03d8d80caeb47741 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
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