python爬虫的制作_python制作最美应用的爬虫

import requests

import re

url = "http://zuimeia.com"

r = requests.get('http://zuimeia.com/community/app/hot/?platform=2')

pattern = re.compile(r'')

urlList = pattern.findall(r.content)

def requestsUrl(url):

r = requests.get(url)

title = re.findall(r'"app-title">

(.*?)

',r.content)

#print title

category = re.findall(r'(.*?)',r.content)

#print category

describe = re.findall(r'

(.*?)
',r.content)

#print type(describe[0])

strdescribe = srtReplace(describe[0])

#print strdescribe

downloadUrl = re.findall(r'

', '
', '', '', '', '', '',

'', '','','', '']

for eachListReplace in listReplace:

string = string.replace(str(eachListReplace),'\n')

string = string.replace('\n\n','')

return string

def categornFinal(category):

categoryFinal =''

for eachCategory in category:

categoryFinal = categoryFinal+str(eachCategory)+'-->'

return categoryFinal

def urlReplace(url):

url = url.replace('&', '&')

return url

requestsUrl("http://zuimeia.com/community/app/27369/?platform=2")

for eachUrl in urlList:

eachUrl = url+eachUrl

content = requestsUrl(eachUrl)

categoryFinal =''

title = content[0][0]

category = categornFinal(content[1])

strdescribe = content[2]

downloadUrl = urlReplace(content[3][0])

with open('c:/wqa.txt', 'a+') as fd:

fd.write('title:'+title+'\n'+'category:'+category+'\n'+'strdescribe:'+strdescribe+'\n'+'downloadUrl:'+downloadUrl+'\n\n\n-----------------------------------------------------------------------------------------------------------------------------\n\n\n')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值