最近竟然被虐,不行~~~
程序员的恋爱,欧耶!!!
网站链接
代码附上
import requests
import re
news={}
def o(what):
global naws
news['机会来了,小伙子']=what
for key in news:
print(key+':'+news[key])
for page in range(1,12000,50):
url='https://tieba.baidu.com/f?kw=%C1%B5%B0%AE&fr=ala0&tpl={}'.format(page)
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40'}
html=requests.get(url=url,headers=headers)
html.encoding='utf-8'
info=re.findall('<a rel="noreferrer" id="thread_top_folder" class="icon_top_folder" href="javascript:;"(.*?)<div class="thread_list_bottom clearfix">',html.text,re.S)
for all_list in info:
main=re.findall('<div class="threadlist_abs threadlist_abs_onlyline ">(.*?)</div>',all_list,re.S)
for content in main:
if content.find('脱单') != -1 or content.find('分手') != -1:
o(content)
else:
pass
效果图
。。。。。程序员的崛起,疯狂繁殖~~~~