python 爬取淘宝 并 分析词频
from urllib import requestimport urllib
import re
from jieba import analyse
search=urllib.parse.quote('哲♂学')
f=open('1.txt','a')
for i in range(10):
print('正在读取第'+str(i+1)+'页数据...')
response=request.urlopen('https://s.taobao.com/search?q='+search+'&s='+str(i*44)).read().decode('utf-8')
title=re.findall(r'"raw_title":"([^"]+)"',response)
for each in title:
f.write(each+'\n')
f.close()
content=open('1.txt','rb').read()
tags = analyse.extract_tags(content, topK=100, withWeight=False)
print(tags)
text =" ".join(tags)
不错 不错啊
页:
[1]