Skip to content

Instantly share code, notes, and snippets.

@drelatgithub
Last active November 18, 2025 03:14
Show Gist options
  • Select an option

  • Save drelatgithub/6f2888c2109f29206786105f2d00db5e to your computer and use it in GitHub Desktop.

Select an option

Save drelatgithub/6f2888c2109f29206786105f2d00db5e to your computer and use it in GitHub Desktop.
Docin document downloader
###############################################################################
#
# Docin document downloader
#
# Valid as of 2022-12-13
#
###############################################################################
import argparse
import os
from types import SimpleNamespace
import urllib.request
conf = SimpleNamespace(
docin_pid = 0,
output_dir = ""
)
def download_image(pid):
i = 0
while True:
i += 1
try:
urllib.request.urlretrieve(
"http://211.147.220.164/index.jsp?file={}&pageno={}".format(pid, i),
os.path.join(conf.output_dir, "{}.png".format(i))
)
except urllib.error.HTTPError:
break
else:
print("Page", i, "saved.")
if __name__ == "__main__":
# Parse the arguments
parser = argparse.ArgumentParser()
parser.add_argument("docin_pid", type=str, help="The number after \"p-\" in docin url")
parser.add_argument("output_dir", type=str, help="The output directory")
args = parser.parse_args()
conf.docin_pid = args.docin_pid
conf.output_dir = args.output_dir
# Do the work
download_image(conf.docin_pid)
@nissansz
Copy link

https://www.docin.com/p-4780561796.html

这个链接没法使用,有办法吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment