#coding: gbk
#使用 Python 3
import http.client,urllib.request,os,re
#獲取各種參數
def GetAll(ZXLink):
	Domain=re.findall(r'http://([^/]+)/.+',ZXLink)[0] # 域名
	URI=re.findall(r'http://[^/]+(/.+)',ZXLink)[0] # URI
	Response = urllib.request.urlopen(ZXLink)
	Web = str(Response.read())
	Response.close()
	PDFLink = re.findall(r'<a href="([^<]+)" target="_blank" >PDF</a>', Web)[0] # PDF 的實際鏈接
	ssNo = re.findall(r'ssNo = "(\d{8})"', Web)[0] # 超星號
	jpgRange = re.findall(r'jpgRange = "(\d+-\d+)"', Web)[0] # 頁碼
	return (PDFLink, Name, ssNo, jpgRange)
#下載
def DownPDF(Link, Page):
	urllib.request.urlretrieve(Link, Path+Page+".pdf")

for a in range(1,100):
	ZX=input("ZX link: ")
	PDFLink, Name, ssNo, jpgRange = GetAll(ZX)
	Path="F:\\"+ssNo+"\\"
	os.makedirs(Path, exist_ok=True)
	DownPDF(PDFLink,jpgRange)
b6bdf6c8105fc44bd5bd834dee7f7e9e450b5a26
<mask token>

<mask token>


def GetAll(ZXLink):
    Domain = re.findall('http://([^/]+)/.+', ZXLink)[0]
    URI = re.findall('http://[^/]+(/.+)', ZXLink)[0]
    Response = urllib.request.urlopen(ZXLink)
    Web = str(Response.read())
    Response.close()
    PDFLink = re.findall('<a href="([^<]+)" target="_blank" >PDF</a>', Web)[0]
    ssNo = re.findall('ssNo = "(\\d{8})"', Web)[0]
    jpgRange = re.findall('jpgRange = "(\\d+-\\d+)"', Web)[0]
    return PDFLink, Name, ssNo, jpgRange


def DownPDF(Link, Page):
    urllib.request.urlretrieve(Link, Path + Page + '.pdf')


<mask token>

<mask token>


def GetAll(ZXLink):
    Domain = re.findall('http://([^/]+)/.+', ZXLink)[0]
    URI = re.findall('http://[^/]+(/.+)', ZXLink)[0]
    Response = urllib.request.urlopen(ZXLink)
    Web = str(Response.read())
    Response.close()
    PDFLink = re.findall('<a href="([^<]+)" target="_blank" >PDF</a>', Web)[0]
    ssNo = re.findall('ssNo = "(\\d{8})"', Web)[0]
    jpgRange = re.findall('jpgRange = "(\\d+-\\d+)"', Web)[0]
    return PDFLink, Name, ssNo, jpgRange


def DownPDF(Link, Page):
    urllib.request.urlretrieve(Link, Path + Page + '.pdf')


for a in range(1, 100):
    ZX = input('ZX link: ')
    PDFLink, Name, ssNo, jpgRange = GetAll(ZX)
    Path = 'F:\\' + ssNo + '\\'
    os.makedirs(Path, exist_ok=True)
    DownPDF(PDFLink, jpgRange)

import http.client, urllib.request, os, re


def GetAll(ZXLink):
    Domain = re.findall('http://([^/]+)/.+', ZXLink)[0]
    URI = re.findall('http://[^/]+(/.+)', ZXLink)[0]
    Response = urllib.request.urlopen(ZXLink)
    Web = str(Response.read())
    Response.close()
    PDFLink = re.findall('<a href="([^<]+)" target="_blank" >PDF</a>', Web)[0]
    ssNo = re.findall('ssNo = "(\\d{8})"', Web)[0]
    jpgRange = re.findall('jpgRange = "(\\d+-\\d+)"', Web)[0]
    return PDFLink, Name, ssNo, jpgRange


def DownPDF(Link, Page):
    urllib.request.urlretrieve(Link, Path + Page + '.pdf')


for a in range(1, 100):
    ZX = input('ZX link: ')
    PDFLink, Name, ssNo, jpgRange = GetAll(ZX)
    Path = 'F:\\' + ssNo + '\\'
    os.makedirs(Path, exist_ok=True)
    DownPDF(PDFLink, jpgRange)

#coding: gbk
#使用 Python 3
import http.client,urllib.request,os,re
#獲取各種參數
def GetAll(ZXLink):
	Domain=re.findall(r'http://([^/]+)/.+',ZXLink)[0] # 域名
	URI=re.findall(r'http://[^/]+(/.+)',ZXLink)[0] # URI
	Response = urllib.request.urlopen(ZXLink)
	Web = str(Response.read())
	Response.close()
	PDFLink = re.findall(r'<a href="([^<]+)" target="_blank" >PDF</a>', Web)[0] # PDF 的實際鏈接
	ssNo = re.findall(r'ssNo = "(\d{8})"', Web)[0] # 超星號
	jpgRange = re.findall(r'jpgRange = "(\d+-\d+)"', Web)[0] # 頁碼
	return (PDFLink, Name, ssNo, jpgRange)
#下載
def DownPDF(Link, Page):
	urllib.request.urlretrieve(Link, Path+Page+".pdf")

for a in range(1,100):
	ZX=input("ZX link: ")
	PDFLink, Name, ssNo, jpgRange = GetAll(ZX)
	Path="F:\\"+ssNo+"\\"
	os.makedirs(Path, exist_ok=True)
	DownPDF(PDFLink,jpgRange)