日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

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

發布時間:2024/10/12 python 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python下载百度云盘中的数据_python爬虫:爬取百度云盘资料,保存下载地址、链接标题、链接详情... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在網上看到的教程,但是我嫌棄那個教程寫的亂(雖然最后顯示我也沒高明多少,哈哈),就隨手寫了一個

主要是嫌棄盤搜那些惡心的廣告,這樣直接下載下來,眼睛清爽多了。

用pyinstall 打包成EXE文件,就可以安安靜靜的下載東西了。。。。

#refer:http://upvup.com/html/python/2015-12-13/21.html

#!/usr/bin/python

# -*- encoding:utf-8 -*-

import requests

from bs4 import BeautifulSoup

import sys

reload(sys)

sys.setdefaultencoding('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')

總結

以上是生活随笔為你收集整理的python下载百度云盘中的数据_python爬虫:爬取百度云盘资料,保存下载地址、链接标题、链接详情...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。