标签:import soup argv for span https pre ems ISE
import requests,bs4,sys,webbrowser
print(‘It is searching...‘)
res=requests.get(‘https://so.csdn.net/so/search/s.do?q=‘+‘ ‘.join(sys.argv[1:]))
res.raise_for_status()
soup=bs4.BeautifulSoup(res.text)
linkElems=soup.select(‘.limit_width a‘)
print(str(len(linkElems))+‘ Found!‘)
numOpen=min(5,len(linkElems))
for i in range(numOpen):
webbrowser.open(linkElems[i].get(‘href‘))
print(str(linkElems[i].get(‘href‘)))
标签:import soup argv for span https pre ems ISE
原文地址:https://www.cnblogs.com/mqx365/p/9986432.html