一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

腳本之家,腳本語言編程技術及教程分享平臺!
分類導航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務器之家 - 腳本之家 - Python - python制作最美應用的爬蟲

python制作最美應用的爬蟲

2020-08-01 12:06土豆去哪了 Python

這篇文章主要介紹了python制作最美應用的爬蟲的相關資料,需要的朋友可以參考下

安卓最美應用頁面爬蟲,爬蟲很簡單,設計的東西到挺多的
文件操作
正則表達式
字符串替換等等

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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('&amp;', '&')
 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')

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 亚洲AV无码乱码在线观看浪潮 | 日本在线一区 | 高h生子双性美人受 | 久久精品亚洲国产AV涩情 | 国产成人愉拍精品 | 春宵福利网站在线观看 | 9999热视频 | 久久婷婷电影网 | 男人懂得网站 | 四虎永久成人免费 | 农夫色综合 | se01在线看片 | 午夜福利试看120秒体验区 | 2021小妲己永久回家地址 | 久久免费看少妇高潮A片2012 | 青草视频在线观看免费资源 | 精品国产自在在线在线观看 | 2022国产麻豆剧传媒剧情 | 福利片成人午夜在线 | 成人啪啪漫画羞羞漫画www网站 | 婚前试爱免费观看 | 日韩在线中文字幕 | 欧美一区二区不卡视频 | 羞羞漫画免费漫画页面在线看漫画秋蝉 | 国产精品久久亚洲一区二区 | 红色播放器 | 国产在线成人a | 亚洲福利在线观看 | 美女脱得一二净无内裤全身的照片 | 二次元美女挤奶漫画 | 免费看美女被靠到爽的视频 | 亚洲精品九色在线网站 | 日韩精品一区二三区中文 | 久久久无码精品亚洲A片猫咪 | 性色欲情网站IWWW九文堂 | 亚洲羞羞裸色私人影院 | 四虎影视色费永久在线观看 | 欧美日韩一区二区中文字幕视频 | 久久成人亚洲 | 99在线播放 | 亚洲成色WWW久久网站夜月 |