This article describes the Python implementation of the 115 network disk automatic download method. Share to everyone for your reference. The implementation methods are as follows:
The 1.txt in the instance is the page http://bbs.pediy.com/showthread.php?t=144788 Save as 1.txt
By copying every 3 seconds a download link to the pasteboard, the copy will automatically call 115 client downloads, each 10 files will manually enter a character, to prevent download too much, card dead machine
The specific code is as follows:
Import re, OS, time import WebBrowser import urllib if __name__ = "__main__": fp = open ("C:\\1.txt") HTTPS = R E.compile (R "(http://u.*)") urllist = [] for URL in Https.findall (Fp.read ()): Urllist.append (URL) downloadurll ist = [] Isfirst = 1 print urllist for URL in urllist:doc = Urllib.urlopen (URL). Read () Redownloadurl = re.c Ompile (R ' (http://115.com/file/.*) ") for DownloadURL in Redownloadurl.findall (DOC): If Isfirst:download Urllist.append (downloadurl) isfirst = 0 Isfirst = 1 #print "-" *20 for URL in Downloadurllist:pri NT URL Import win32clipboard import Win32con def copytoclipboard (copytext): Win32clipboard. OpenClipboard () Win32clipboard. EmptyClipboard () Win32clipboard. SetClipboardData (Win32con. Cf_text, CopyText) Win32clipboard. CloseClipboard () #downloadUrlList = ["Http://115.com/file/cmlirmfo", "HTTP://115.COM/FILE/EW7HTCJC", "http://115". Com/file/cm25l95e "," http://115.Com/file/atn8dsgj "," http://115.com/file/b3e0ae5k "," http://115.com/file/cm27rs3g "," HTTP://115.COM/FILE/CMKWJPA1 "," http://115.com/file/ew4sx25c "," Http://115.com/file/d2b1alj8 "," http://115.com/file/b3c29o48 "," http://115.com /FILE/EW8CTKYC "," Http://115.com/file/b3m4ea70 "," HTTP://115.COM/FILE/ATCPH3MD "," http://115.com/file/ew9fw53a "," Http://115.com/file/cm512ct1 "," http://115.com/file/ewx7d35c "," Http://115.com/file/at8nd5xj "," http://115.com/ FILE/EWCS6JBJ "," http://115.com/file/b3104ve1 "," Http://115.com/file/b3b1koke "," Http://115.com/file/d2st6pv6 "," Http://115.com/file/atb20b6h "," Http://115.com/file/b353salz "," HTTP://115.COM/FILE/ATZILRKP "," http://115.com/ File/cmg35and "," Http://115.com/file/cmq5ceje "," http://115.com/file/atkdb5oc "," Http://115.com/file/d297u2v6 "," Http://115.com/file/ataqteic "," Http://115.com/file/cm7ralmz "," Http://115.com/file/cm70v4nr "," http://115.com/ File/cmfhr2so "," Http://115.com/file/atvtkaja "," Http://115.com/file/b3t7b6aw "," Http://115.com/file/atoyp4iz "," Http://115.com/file/ewpk79kj "," http://115.com/file/at5k044x "," http://115.com/file/d2mo0678 "," http://115.com/file/a9hegswp "," http ://115.com/file/bl472ir1 "," Http://115.com/file/dl2dgqi9 "," http://115.com/file/dl20ky2a "," http://115.com/file/ Bll2yssk "," Http://115.com/file/a9jzzlca "," http://115.com/file/c4z1ek4d "," Http://115.com/file/blpk4pv1 "," http:/ /115.com/file/c4rjotdz "," Http://115.com/file/a9g43daa "," HTTP://115.COM/FILE/EFNN38JR "," http://115.com/file/ C4leomjd "," http://115.com/file/dlpw9s6i "," http://115.com/file/a9n0jv8x "," Http://115.com/file/c48savoo "," http:/ /115.com/file/ef8og8la "," HTTP://115.COM/FILE/A9CJK9LX "," Http://115.com/file/blo38e31 "," http://115.com/file/ A987cika "," http://115.com/file/c4vic87g "," Http://115.com/file/bl5l0syx "," Http://115.com/file/c4gdl7ne "," http:/ /115.com/file/efym0xhy "," http://115.com/file/dl88b43f "," Http://115.com/file/bw4wfxa1 "," http://115.com/file/ Eswz3bgj "," http://115.com/file/czw0b3g2 "," Http://115.com/file/dis9mjcx "," Http://115.com/file/ajzrgiyz "," http:/ /115.com/file/es5o43lZ "," Http://115.com/file/dnasw0kp "," Http://115.com/file/dnagnndx "," Http://115.com/file/clwr2xxg "," http://115. " Com/file/bhbcnnwe "," Http://115.com/file/aq2rp9ga "," http://115.com/file/e601turs "," http://115.com/file/dn46qs7x "," Http://115.com/file/clwonrwg "," HTTP://115.COM/FILE/DN43I7JF "," Http://115.com/file/bhbgrnfz "," http://115.com /file/dnsl0kxp "] i = 0 while i<100:if len (downloadurllist) = = 0:break CopyToClipboard (downloadurlli
St.pop ()) Time.sleep (3) i = i + 1 if i% = = 0:os.system ("pause") print "after Pause"
Hopefully this article will help you with your Python programming.