安卓最美应用页面爬虫,爬虫很简单,设计的东西到挺多的
文件操作
正则表达式
字符串替换等等
import requests
import re
url = "http://zuimeia.com"
r = requests.get('http://zuimeia.com/community/app/hot/?platform=2')
pattern = re.compile(r'<a class="community-app-cover-wrapper" href="(.*?)" target="_blank">')
urlList = pattern.findall(r.content)
def requestsUrl(url):
r = requests.get(url)
title = re.findall(r'"app-title"><h1>(.*?)</h1>',r.content)
#print title
category = re.findall(r'<a class="app-tag" href="/community/app/category/title/.*?/?platform=2">(.*?)</a>',r.content)
#print category
describe = re.findall(r'<div id="article_content">(.*?)<div class="community-image-wrapper">',r.content)
#print type(describe[0])
strdescribe = srtReplace(describe[0])
#print strdescribe
downloadUrl = re.findall(r'<a class="download-button direct hidden" href="(.*?)"',r.content)
#print downloadUrl
return title,category,strdescribe,downloadUrl
def srtReplace(string):
listReplace = ['<p>', '<br>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<h7>','<strong>','</p>', '<br/>', '</h1>', '</h2>', '</h3>', '</h4>', '</h5>',
'</h6>', '</h7>','</strong>','<b>', '</b>']
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')
该软件是以ecshop作为核心的仿制万表网的商场网站源码。万表网模板 2015最新版整体简洁大气,功能实用,是一款时尚典雅的综合类模板!样式精美的商品分类树,层次分明,分类结构一目了然。首页轮播主广告分别对应切换小广告,商品宣传更到位。独家特色增加顶级频道页面、品牌页面,以及仿京东对比功能,提升网站档次,让您的网站更加高端大气!并且全站采用div+css布局,兼容性良好,更注重页面细节,增加多种j
0
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号