代码如下:
#!/usr/bin/python3.2import os,socketimport urllibimport urllib.request,threading,timeimport re,sysglobal manhuaweb,weburl,floder,chapterbegin,currentthreadnum,threadcount,mutex,mutex2
weburl=”floder=”chapterbegin=0currentthreadnum=0threadcount=6
if len(sys.argv)>=3: weburl=sys.argv[1] floder=sys.argv[2]else: print(“usag: downloadmanhua weburl floder chapterbegin=0 threadnnum=6”) sys.exit(0)if len(sys.argv)>=4: chapterbegin=int(sys.argv[3])if len(sys.argv)>=5: threadcount=(int)(sys.argv[4])
def jin(i,jinzhi): finalans=”” answer=i%jinzhi i=int(i/jinzhi) if answer>9: finalans=finalans+chr(ord(‘a’)+(answer-10)) else: finalans=finalans+str(answer) if i!=0: finalans=jin(i,jinzhi)+finalans return finalansdef urlparse(p,a,c,k): d={} e=lambda c: jin(c,36) if 1: while c: c=c-1 if not k[c]: d[jin(c,36)]=jin(c,36) else: d[jin(c,36)]=k[c] k=[lambda e:d[e]] e=lambda c:’\\w+’ c=1 newstr=”” while c: c=c-1 if k[c]: for i in range(0,len(p)): tempi=p[i] tempi=ord(tempi) if tempi>=ord(‘a’) and tempi=ord(‘0’) and tempi