python爬虫:爬取百度云盘资料,保存下载地址、链接标题、链接详情 您所在的位置:网站首页 爬百度网盘链接 python爬虫:爬取百度云盘资料,保存下载地址、链接标题、链接详情

python爬虫:爬取百度云盘资料,保存下载地址、链接标题、链接详情

2023-06-28 00:57| 来源: 网络整理| 查看: 265

'utf-8')

def yunpan_search(key): url='http://www.wangpansou.cn/s.php?q='+key html=requests.get(url) soup=BeautifulSoup(html.text,"lxml") url_get=soup.find_all('a',{'class':'cse-search-result_content_item_top_a'}) info_get=soup.find_all('div',{'class':'cse-search-result_content_item_mid'}) f = open('baidu_source.txt','w') for i in range(len(url_get)): href=url_get[i]['href'] title='' for c in url_get[i].children: title+=c.string.strip()

information='' for info in info_get[i].children: information+=info.string.strip().replace('\n','')

print str(i+1)+'_'*60 print '下载地址--'+href+'\n'+'链接标题--'+title+'\n'+'链接详情--'+information+'\n\n' f.write(str(i+1)+'. _____________________________________________________________________\n') f.write('下载地址--'+href+'\n'+'链接标题--'+title+'\n'+'链接详情--'+information+'\n\n') f.close()

if __name__=='__main__': key=raw_input('please input what you want to look for:') yunpan_search(key) print('finish')



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有