1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
| import requests import os from requests.exceptions import ReadTimeout import chardet from bs4 import BeautifulSoup import re import json import math from PIL import Image import pdfkit from GetPpt import GetPpt import time
class GetAll: def __init__(self, url, savepath): """ :param url: 待爬取文档所在页面的url :param savepath: 生成文档保存路径 """ self.url = url self.savepath = savepath if savepath != '' else os.getcwd() self.startpage = 1 self.url = self.url + "&pn=1" self.html = '' self.wkinfo ={} self.jsonurls = [] self.pdfurls = []
self.getHtml() self.getWkInfo() self.htmlsdirpath = self.makeDirForHtmlSave() self.pdfsdirpath = self.makeDirForPdfSave() self.htmlfile = self.wkinfo.get('title')+".html"
def makeDirForHtmlSave(self): if not os.path.exists(os.path.join(self.savepath,'htmlfiles')): os.mkdir(os.path.join(self.savepath,'htmlfiles')) return os.path.join(self.savepath, 'htmlfiles')
def makeDirForPdfSave(self): if not os.path.exists(os.path.join(self.savepath, 'pdffiles')): os.mkdir(os.path.join(self.savepath,'pdffiles')) return os.path.join(self.savepath,'pdffiles')
def creatHtml(self): with open(os.path.join(self.htmlsdirpath, str(self.startpage) + self.htmlfile), "w") as f: message = """ <!DOCTYPE html> <html class="expanded screen-max"> <head> <meta charset="utf-8"> <title>文库</title>""" f.write(message)
def addMessageToHtml(self,message): """:param message:向html文档中添加内容 """ with open(os.path.join(self.htmlsdirpath, str(self.startpage) + self.htmlfile), "a", encoding='utf-8') as a: a.write(message)
def getHtml(self): try: header = {'User-Agent': 'Mozilla/5.0 ' '(Macintosh; Intel Mac OS X 10_14_6) ' 'AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/78.0.3904.108 Safari/537.36'} response = requests.get(self.url, headers = header) self.transfromEncoding(response) self.html = BeautifulSoup(response.text, 'html.parser') except ReadTimeout as e: print(e)
def transfromEncoding(self, html): html.encoding = chardet.detect(html.content).get("encoding")
def getWkInfo(self): items = ["'title'","'docType'","'docId'","'totalPageNum"] for item in items: ls = re.findall(item+".*'", str(self.html)) if len(ls) != 0: message = ls[0].split(':') self.wkinfo[eval(message[0])] = eval(message[1])
def getJsonUrl(self): urlinfo = re.findall("WkInfo.htmlUrls = '.*?;", str(self.html)) urls = re.findall("https:.*?}", urlinfo[0]) urls = [str(url).replace("\\", "").replace('x22}','') for url in urls ] self.jsonurls = urls
def getJson(self, url): """ :param url: json文件所在页面的url :return: json格式字符串 """ response = requests.get(url) jsonstr = response.text[response.text.find('(')+1: response.text.rfind(')')] return jsonstr
def convertJsonToDict(self, jsonstr): """ :param jsonstr: json格式字符串 :return: json字符串所对应的python字典 """ textdict = json.loads(jsonstr) return textdict
def isPptStyle(self): iswholepic = False ispptlike = False for url in self.jsonurls: if "0.json" in url: textdict = self.convertJsonToDict(self.getJson(url)) if textdict.get("style") == "" and textdict.get("font") is None: iswholepic = True break elif textdict.get('page').get('pptlike'): ispptlike = True break break
return iswholepic and ispptlike
def getCssUrl(self): pattern = re.compile('<link href="//.*?\.css') allmessage = pattern.findall(str(self.html)) allcss = [x.replace('<link href="', "https:") for x in allmessage] return allcss
def getPageTag(self): """:return:返回id属性包含 data-page-no 的所有标签,即所有页面的首标签""" def attributeFilter(tag): return tag.has_attr('data-page-no') return self.html.find_all(attributeFilter)
def getDocIdUpdate(self): """:return:doc_id_update字符串""" pattern = re.compile('doc_id_update:".*?"') for i in pattern.findall(str(self.html)): return i.split('"')[1]
def getAllReaderRenderStyle(self): """:return: style <id = "reader - render - style">全部内容""" page = 1 style = '<style id='+'"reader-render-style">\n' for url in self.jsonurls: if "json" in url: textdict = self.convertJsonToDict(self.getJson(url)) style += self.getReaderRenderStyle(textdict.get('style'), textdict.get('font'), textdict.get('font'), page) page += 1 else: break style += "</style>\n"
return style
def getReaderRenderStyle(self, allstyle, font, r, page): """ :param allstyle: json数据的style内容 :param font: json数据的font内容 :param r: TODO:解析作用未知,先取值与e相同 :param page: 当前页面 :return: style <id = "reader - render - style"> """ p, stylecontent = "", [] for index in range(len(allstyle)): style = allstyle[index] if style.get('s'): p = self.getPartReaderRenderStyle(style.get('s'), font, r).strip(" ") l = "reader-word-s" + str(page) + "-" p and stylecontent.append("." + l + (",." + l).join([str(x) for x in style.get('c')]) + "{ " + p + "}") if style.get('s').get("font-family"): pass stylecontent.append("#pageNo-" + str(page) + " .reader-parent{visibility:visible;}") return "".join(stylecontent)
def getPartReaderRenderStyle(self, s, font, r): """ :param s: json style下的s属性 :param font: json font属性 :param r: fontMapping TODO:先取为与e相同 :return: style <id = "reader - render - style">中的部分字符串 """ content = [] n, p = 10, 1349.19 / 1262.85
def fontsize(f): content.append("font-size:" + str(math.floor(eval(f) * n * p)) + "px;")
def letterspacing(l): content.append("letter-spacing:" + str(eval(l) * n) + "px;")
def bold(b): "false" == b or content.append("font-weight:600;")
def fontfamily(o): n = font.get(o) or o if font else o content.append("font-family:'" + n + "','" + o + "','" + (r.get(n) and r[n] or n) + "';")
for attribute in s: if attribute == "font-size": fontsize(s[attribute]) elif attribute == "letter-spacing": letterspacing(s[attribute]) elif attribute == "bold": bold(s[attribute]) elif attribute == "font-family": fontfamily(s[attribute]) else: content.append(attribute + ":" + s[attribute] + ";") return "".join(content)
def AddCss(self): urls = self.getCssUrl() urls = [url for url in urls if "htmlReader" in url or "core" in url or "main" in url or "base" in url] for url in urls: message = '<style type="text/css">'+requests.get(url).text+"</style>>" self.addMessageToHtml(message)
content = self.getAllReaderRenderStyle() self.addMessageToHtml(content)
def addMainContent(self): """ :param startpage: 开始生成的页面数 :return: """
self.addMessageToHtml("\n\n\n<body>\n") docidupdate = self.getDocIdUpdate()
jsonurl = [x for x in self.jsonurls if "json" in x] pngurl = [x for x in self.jsonurls if "png" in x]
tags = self.getPageTag() for page, tag in enumerate(tags): if page > 50: break tag['style'] = "height: 1349.19px;" tag['id'] = "pageNo-" + str(page+1) self.addMessageToHtml(str(tag).replace('</div>', '')) diu = self.getDocIdUpdate() n = "-webkit-transform:scale(1.00);-webkit-transform-origin:left top;" textdict = self.convertJsonToDict(self.getJson(jsonurl[page]))
if page < len(pngurl): maincontent = self.creatMainContent(textdict.get('body'), textdict.get('page'), textdict.get('font'), page + 1, docidupdate, pngurl[page]) else: maincontent = self.creatMainContent(textdict.get('body'), textdict.get('page'), textdict.get('font'), page + 1, docidupdate, "") content = "".join([ '<div class="reader-parent-' + diu + " reader-parent " + '" style="position:relative;top:0;left:0;' + n + '">', '<div class="reader-wrap' + diu + '" style="position:absolute;top:0;left:0;width:100%;height:100%;">', '<div class="reader-main-' + diu + '" style="position:relative;top:0;left:0;width:100%;height:100%;">', maincontent, "</div>", "</div>", "</div>", "</div>"])
self.addMessageToHtml(content) print("已完成%s页的写入,当前写入进度为%f" % (str(page+self.startpage), 100*(page+self.startpage)/int(self.wkinfo.get('totalPageNum'))) + '%')
self.addMessageToHtml("\n\n\n</body>\n</html>")
def isNumber(self, obj): """ :param obj:任意对象 :return: obj是否为数字 """ return isinstance(obj, int) or isinstance(obj, float)
def creatMainContent(self, body, page, font, currentpage, o, pngurl): """ :param body: body属性 :param page: page属性 :param font: font属性 :param currentpage: 当前页面数 :param o:doc_id_update :param pngurl: 图片所在url :return:文本及图片的html内容字符串 """ content, p, s, h = 0, 0, 0, 0 main = [] l = 2 c = page.get('v')
d = font y = { "pic": '<div class="reader-pic-layer" style="z-index:__NUM__"><div class="ie-fix">', "word": '<div class="reader-txt-layer" style="z-index:__NUM__"><div class="ie-fix">' } g = "</div></div>" MAX1 , MAX2 = 0, 0 body = sorted(body, key=lambda k: k.get('p').get('z')) for index in range(len(body)): content = body[index] if "pic" == content.get('t'): MAX1 = max(MAX1, content.get('c').get('ih') + content.get('c').get('iy') + 5) MAX2 = max(MAX2, content.get('c').get('iw')) for index in range(len(body)): content = body[index] s = content.get('t') if not p: p = h = s if p == s: if content.get('t') == "word": main.append(self.creatTagOfWord(content, currentpage, font, d, c)) elif content.get('t') == 'pic': main.append(self.creatTagOfImage(content, pngurl, MAX1, MAX2)) else: main.append(g) main.append(y.get(s).replace('__NUM__', str(l))) l += 1 if content.get('t') == "word": main.append(self.creatTagOfWord(content, currentpage, font, d, c)) elif content.get('t') == 'pic': main.append(self.creatTagOfImage(content, pngurl, MAX1, MAX2)) p = s return y.get(h).replace('__NUM__', "1") + "".join(main) + g
def creatTagOfWord(self, t, currentpage, font, o, version, *args): """ :param t: body中的每个属性 :param currentpage: page :param font: font属性 :param o:font属性 :param version: page中的version属性 :param args: :return:<p>标签--文本内容 """ p = t.get('p') ps = t.get('ps') s = t.get('s') z = ['<b style="font-family:simsun;"> </b>', "\n"] k, N = 10, 1349.19 / 1262.85 U = self.O(ps) w, h, y, x, D= p.get('w'), p.get('h'), p.get('y'), p.get('x'), p.get('z') pattern=re.compile("[\s\t\0xa0]| [\0xa0\s\t]$") final = []
if U and ps and ((ps.get('_opacity') and ps.get('_opacity') == 1) or (ps.get('_alpha') and ps.get('_alpha') == 0)): return "" else: width = math.floor(w * k * N) height = math.floor(h * k * N) final.append("<p "+'class="'+"reader-word-layer" + self.processStyleOfR(t.get('r'), currentpage) + '" ' + 'style="' + "width:" +str(width) + "px;" + "height:" + str(height) + "px;" + "line-height:" + str(height) + "px;") final.append("top:"+str(math.floor(y * k * N))+"px;"+"left:"+str(math.floor(x * k * N))+"px;"+"z-index:"+str(D)+";") final.append(self.processStyleOfS(s, font, o, version)) final.append(self.processStyleOf_rotate(ps.get('_rotate'), w, h, x, y, k, N) if U and ps and self.isNumber(ps.get('_rotate')) else "") final.append(self.processStyleOfOpacity(ps.get('_opacity')) if U and ps and ps.get('_opacity') else "") final.append(self.processStyleOf_scaleX(ps.get('_scaleX'), width, height) if U and ps and ps.get('_scaleX') else "") final.append(str(isinstance(t.get('c'), str) and len(t.get('c')) == 1 and pattern.match(t.get('c')) and "font-family:simsun;") if isinstance(t.get('c'), str) and len(t.get('c')) == 1 and pattern.match(t.get('c')) else "") final.append('">') final.append(t.get('c') if t.get('c') else "") final.append(U and ps and str(self.isNumber(ps.get('_enter'))) and z[ps.get('_enter') if ps.get('_enter') else 1] or "") final.append("</p>")
return "".join(final)
def processStyleOfS(self, t, font, r, version): """ :param t: 文本的s属性 :param font: font属性 :param r:font属性 :param version: :return:处理好的S属性字符串 """ infoOfS = [] n = {"font-size": 1} p , u = 10, 1349.19 / 1262.85
def fontfamily(o): n = font.get(o) or o if font else o if abs(version) > 5: infoOfS.append("font-family:'"+ n + "','" + o + "','" + (r.get('n') and r[n] or n) + "';") else: infoOfS.append("font-family:'" + o + "','" + n + "','" + (r.get(n) and r[n] or n) + "';")
def bold(e): "false" == e or infoOfS.append("font-weight:600;")
def letter(e): infoOfS.append("letter-spacing:" + str(eval(e) * p) + "px;")
if t is not None: for attribute in t: if attribute == "font-family": fontfamily(t[attribute]) elif attribute == "bold": bold(t[attribute]) elif attribute == "letter-spacing": letter(t[attribute]) else: infoOfS.append(attribute + ":" + (str(math.floor(((t[attribute] if self.isNumber(t[attribute]) else eval(t[attribute])) * p * u))) + "px" if n.get(attribute) else t[attribute]) + ";")
return "".join(infoOfS)
def processStyleOfR(self, r, page): """ :param r: 文本的r属性 :param page: 当前页面 :return: """ l = " " + "reader-word-s" + str(page) + "-" return "".join([l + str(x) for x in r]) if isinstance(r, list) and len(r) != 0 else ""
def processStyleOf_rotate(self, t, w, h, x, y, k, N): """ :param t: _rotate属性 :param w: body中p.w :param h: body中p.h :param x: body中p.x :param y: body中p.y :param k: 倍数10 :param N: 比例系数 :return: 处理好的_rotate属性字符串 """ p = [] s = k * N if t == 90: p.append("left:" + str(math.floor(x + (w - h) / 2) * s) + "px;" + "top:" + str(math.floor(y - (h - w) / 2) * s) + "px;" + "text-align: right;" + "height:" + str(math.floor(h + 7) * s) + "px;") elif t == 180: p.append("left:" + str(math.floor(x - w) * s) + "px;" + "top:" + str(math.floor(y - h) * s) + "px;") elif t == 270: p.append("left:" + str(math.floor(x + (h - w) / 2) * s) + "px;" + "top:" + str(math.floor(y - (w - h) / 2) * s) + "px;")
return "-webkit-"+"transform:rotate("+str(t)+"deg);"+"".join(p)
def processStyleOf_scaleX(self, t, width, height): """ :param t: _scaleX属性 :param width: 计算好的页面width :param height:计算好的页面height :return: 处理好的_scaleX属性字符串 """ return "-webkit-" + "transform: scaleX(" + str(t) + ");" + "-webkit-" + "transform-origin:left top;width:" + str(width + math.floor(width / 2)) + "px;height:" + str(height + math.floor(height / 2)) + "px;"
def processStyleOfOpacity(self,t): """ :param t: opacity属性 :return:处理好的opacity属性字符串 """ t = (t or 0), return "opacity:" + str(t) + ";"
def creatTagOfImage(self,t,url, *args): """ :param t: 图片的字典 :param url:图片链接 :param args: :return:图像标签 """ u, l = t.get('p'), t.get('c') if u.get("opacity") and u.get('opacity') == 0: return "" else: if u.get("x1") or (u.get('rotate') != 0 and u.get('opacity') != 1): message = '<div class="reader-pic-item" style="' + "background-image: url(" + url + ");" + "background-position:" + str(-l.get('ix')) + "px " + str(-l.get('iy')) + "px;" \ + "width:" + str(l.get('iw')) + "px;" + "height:" + str(l.get('ih')) + "px;" + self.getStyleOfImage(u, l) + 'position:absolute;overflow:hidden;"></div>' else: [s, h] = [str(x) for x in args] message = '<p class="reader-pic-item" style="' + "width:" + str(l.get('iw')) + "px;" + "height:" + str(l.get('ih')) + "px;" + self.getStyleOfImage(u, l) + 'position:absolute;overflow:hidden;"><img width="' + str(h) + '" height="' + str(s) + '" style="position:absolute;top:-' + str(l.get('iy')) + "px;left:-" + str(l.get('ix')) + "px;clip:rect(" + str(l.get('iy')) + "px," + str(int(h) - l.get('ix')) + "px, " + str(s) + "px, " + str(l.get('ix')) + 'px);" src="' + url + '" alt=""></p>'
return message
def getStyleOfImage(self, t, e): """ :param t: 图片p属性 :param e: 图片c属性 :return: """ def parseFloat(string): """ :param string:待处理的字符串 :return: 返回字符串中的首个有效float值,若字符首位为非数字,则返回nan """ if string is None: return math.nan elif isinstance(string, float): return string elif isinstance(string, int): return float(string) elif string[0] != ' ' and not str.isdigit(string[0]): return math.nan else: p = re.compile("\d+\.?\d*") all = p.findall(string) return float(all[0]) if len(all) != 0 else math.nan
if t is None: return "" else: r, o, a, n = 0, 0, "", 0 iw = e.get('iw') ih = e.get('ih') u = 1349.19 / 1262.85 l = str(t.get('x') * u) + "px" c = str(t.get('y') * u) + "px" d = "" x = {} w = {"opacity": 1, "rotate": 1, "z": 1} for n in t: x[n] = t[n] * u if (self.isNumber(t[n]) and not w.get(n)) else t[n]
if x.get('w') != iw or x.get('h') != ih: if x.get('x1'): a = self.P(x.get('x0'), x.get('y0'), x.get('x1'), x.get('y1'), x.get('x2'), x.get('y2')) r = parseFloat(parseFloat(a[0])/iw if len(a) else x.get('w') / iw) o = parseFloat(parseFloat(a[1])/ih if len(a) else x.get('h') / ih)
m, v = iw * (r-1), ih * (o-1) c = str((x.get('y1') + x.get('y3')) / 2 - parseFloat(ih) / 2)+"px" if x.get('x1') else str(x.get('y') + v / 2) + "px" l = str((x.get('x1') + x.get('x3')) / 2 - parseFloat(iw) / 2)+"px" if x.get('x1') else str(x.get('x') + m / 2) + "px" d = "-webkit-" + "transform:scale(" + str(r) + "," + str(o) + ")"
message = "z-index:" + str(x.get('z')) + ";" + "left:" + l + ";" + "top:" + c + ";" + "opacity:" + str(x.get('opacity') or 1) + ";" if x.get('x1'): message += self.O(x.get('rotate')) if x.get('rotate') > 0.01 else self.O(0, x.get('x1'), x.get('x2'), x.get('y0'), x.get('y1'), d) else: message += d + ";"
return message
def P(self,t, e, r, i, o, a): p = round(math.sqrt(math.pow(abs(t - r), 2) + math.pow(abs(e - i), 2)), 4) s = round(math.sqrt(math.pow(abs(r - o), 2) + math.pow(abs(i - a), 2)), 4) return [s, p]
def O(self, t, *args): [e, r, i, o, a] = [0, 0, 0, 0, ""] if len(args) == 0 else [x for x in args] n = o > i p = e > r if n and p: a += " Matrix(1,0,0,-1,0,0)" elif n: a += " Matrix(1,0,0,-1,0,0)" elif p: a += " Matrix(-1,0,0,1,0,0)" elif t: a += " rotate(" + str(t) + "deg)" return a + ";"
def convertHtmlToPdf(self): savepath = os.path.join(self.pdfsdirpath, str(self.startpage)+self.wkinfo.get('title') + '.pdf')
exactpages = int(self.wkinfo.get('totalPageNum')) if exactpages > 50: exactpages = 50 options = {'disable-smart-shrinking':'', 'lowquality': '', 'image-quality': 60, 'page-height': str(1349.19*0.26458333), 'page-width': '291', 'margin-bottom': '0', 'margin-top': '0', } pdfkit.from_file(os.path.join(self.htmlsdirpath, str(self.startpage) + self.htmlfile), savepath, options=options)
def Run(self): self.getJsonUrl() if self.isPptStyle(): GetPpt(self.url, self.savepath).getPPT() else: for epoch in range(int(int(self.wkinfo.get('totalPageNum'))/50)+1): self.startpage = epoch * 50 + 1 if epoch == 0: self.creatHtml()
start = time.time() print('-------------Start Add Css--------------') self.AddCss() print('-------------Css Add Finissed-----------') end = time.time() print("Add Css Cost: %ss" % str(end - start))
start = time.time() print('-------------Start Add Content----------') self.addMainContent() print('-------------Content Add Finished-------') end = time.time() print("Add MainContent Cost: %ss" % str(end - start))
start = time.time() print('-------------Start Convert--------------') self.convertHtmlToPdf() print('-------------Convert Finished-----------') end = time.time() print("Convert Cost: %ss" % str(end - start)) else: self.url = self.url[:self.url.find('&pn=')] + "&pn=" + str(self.startpage) print(self.url) self.getHtml() self.getJsonUrl()
self.creatHtml()
start = time.time() print('-------------Start Add Css--------------') self.AddCss() print('-------------Css Add Finissed-----------') end = time.time() print("Add Css Cost: %ss" % str(end - start))
start = time.time() print('-------------Start Add Content----------') self.addMainContent() print('-------------Content Add Finished-------') end = time.time() print("Add MainContent Cost: %ss" % str(end - start))
start = time.time() print('-------------Start Convert--------------') self.convertHtmlToPdf() print('-------------Convert Finished-----------') end = time.time() print("Convert Cost: %ss" % str(end - start))
if __name__ == '__main__': GetAll('https://wenku.baidu.com/view/fb92d7d3b8d528ea81c758f5f61fb7360a4c2b61.html?from=search',"存储路径").Run()
|