Bored at home, want to see a novel, but look at the pain of the eyes, think of the next sound novel to listen to. But the wind found all to be a episode of a set, but also to rename, 122 episodes Ah, point to when.
Write a script to download the batch process. Record the process.
One, the old routine, find the download URL. By viewing the Web page source, Discover homepage: http://www.qktsw.com/down/1831.html's Download list is hidden in:
Open this JS file and see what the thing is:
Look at the red things, feel familiar, this is the homepage above the download list of the ID number:
Second, get ID number:
Simple, Regular expression:
M=re.compile (R ' \$ (. *?) \$ ')
Result=m.findall (content)
I=0
For s in result:
Print S
Result is a matching list of all IDs.
Next, write it in the file:
fp = open(file, ‘wb‘)req = urllib2.urlopen(url)for line in req: fp.write(line)fp.close()
All codes are as follows:
#Coding=utf-8__author__='Administrator'ImportUrllib2Importrecontent= Urllib2.urlopen ('Http://www.qktsw.com/playdata/39/1831.js'). Read () m=re.compile (R'\$(.*?) \$') Result=M.findall (content) I=0rawStr='http://www.qktsw.com/downbook.asp?id=' forSinchResult:Prints I+=1FP= Open (str (i) +'. F4V','WB') Req= Urllib2.urlopen (rawstr+s) forLineinchReq:fp.write (line) fp.close ()Print 'end of episode%d', I
Download down:
You can listen to it when you open it! Hey, fix it.
Python Combat: Download Ghost report Audio Fiction