python制作最美應(yīng)用的爬蟲(chóng)
安卓最美應(yīng)用頁(yè)面爬蟲(chóng),爬蟲(chóng)很簡(jiǎn)單,設(shè)計(jì)的東西到挺多的
文件操作
正則表達(dá)式
字符串替換等等
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')
- python模擬新浪微博登陸功能(新浪微博爬蟲(chóng))
- Python爬蟲(chóng)框架Scrapy安裝使用步驟
- python抓取網(wǎng)頁(yè)圖片示例(python爬蟲(chóng))
- 使用Python編寫(xiě)簡(jiǎn)單網(wǎng)絡(luò)爬蟲(chóng)抓取視頻下載資源
- 零基礎(chǔ)寫(xiě)python爬蟲(chóng)之使用urllib2組件抓取網(wǎng)頁(yè)內(nèi)容
- 零基礎(chǔ)寫(xiě)python爬蟲(chóng)之爬蟲(chóng)編寫(xiě)全記錄
- 零基礎(chǔ)寫(xiě)python爬蟲(chóng)之使用Scrapy框架編寫(xiě)爬蟲(chóng)
- Python實(shí)現(xiàn)抓取頁(yè)面上鏈接的簡(jiǎn)單爬蟲(chóng)分享
- python3簡(jiǎn)單實(shí)現(xiàn)微信爬蟲(chóng)
- python編寫(xiě)爬蟲(chóng)小程序
- 基python實(shí)現(xiàn)多線程網(wǎng)頁(yè)爬蟲(chóng)
- Python制作爬蟲(chóng)采集小說(shuō)
- python制作花瓣網(wǎng)美女圖片爬蟲(chóng)
相關(guān)文章
淺談Keras參數(shù) input_shape、input_dim和input_length用法
這篇文章主要介紹了淺談Keras參數(shù) input_shape、input_dim和input_length用法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-06-06
使用Python實(shí)現(xiàn)一個(gè)本地視頻流媒體服務(wù)器
你是否曾經(jīng)想過(guò)在本地網(wǎng)絡(luò)上輕松地將電腦上的視頻分享給手機(jī)或平板電腦觀看?也許你下載了一部電影,想在客廳的智能電視上播放,卻不想費(fèi)力地拷貝文件,今天,小編將給大家介紹如何使用Python構(gòu)建一個(gè)簡(jiǎn)單的本地視頻流媒體服務(wù)器,需要的朋友可以參考下2025-04-04
python 監(jiān)控某個(gè)進(jìn)程內(nèi)存的情況問(wèn)題
這篇文章主要介紹了python 監(jiān)控某個(gè)進(jìn)程內(nèi)存的情況問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-05-05
python實(shí)現(xiàn)數(shù)據(jù)分析與建模
這篇文章主要介紹了python實(shí)現(xiàn)數(shù)據(jù)分析與建模功能,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-07-07
python編程通過(guò)蒙特卡洛法計(jì)算定積分詳解
這篇文章主要介紹了python編程通過(guò)蒙特卡洛法計(jì)算定積分詳解,具有一定借鑒價(jià)值,需要的朋友可以參考下。2017-12-12
利用Python繪制Jazz網(wǎng)絡(luò)圖的例子
今天小編就為大家分享一篇利用Python繪制Jazz網(wǎng)絡(luò)圖的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-11-11
Python 腳本獲取ES 存儲(chǔ)容量的實(shí)例
今天小編就為大家分享一篇Python 腳本獲取ES 存儲(chǔ)容量的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-12-12
Python爬蟲(chóng)逆向分析某云音樂(lè)加密參數(shù)的實(shí)例分析
這篇文章主要介紹了Python爬蟲(chóng)逆向分析某云音樂(lè)加密參數(shù),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-12-12

