This article describes the Python implementation of the 115 automatic network disk download method. Share to everyone for your reference. The implementation method is as follows:
1.txt in the instance, is the Web http://bbs.pediy.com/showthread.php?t=144788 saved as 1.txt
By copying a download link to the Clipboard every 3 seconds, the copy will automatically call 115 client download, each download 10 files will be manually entered a character, to prevent the download too much, the card dead machine
The specific code is as follows:
Import Re, OS, Timeimport webbrowserimport urllib if __name__ = = "__main__": fp = open ("C:\\1.txt") HTTPS = Re.compil E (R "(http://u.*)") urllist = [] for URL in Https.findall (Fp.read ()): Urllist.append (URL) downloadurllist = [] IsF Irst = 1 print urllist for URL in urllist:doc = Urllib.urlopen (URL). Read () Redownloadurl = Re.compile (R ' (HTTP://1 15.com/file/.*) "') for DownloadURL in Redownloadurl.findall (DOC): If IsFirst:downloadUrlList.append (Downlo Adurl) IsFirst = 0 IsFirst = 1 #print "-" *20 for URLs in downloadurllist:print URL import win32cli Pboard 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 (Downloadurllist.pop ()) Time.sleep (3) i = i + 1 if i% 10 = = 0:os.system ("pause") print "after Pause"
Hopefully this article will help you with Python programming.