Python Combat: Download Ghost report Audio Fiction

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.