看板 Python 關於我們 聯絡資訊
我想要爬Facebook好友名稱 使用beautifulsoup沒有出現錯誤訊息但好友名稱也沒出來 具體程式碼在下面 from selenium import webdriver import time,re from bs4 import BeautifulSoup driver=webdriver.Firefox() driver.get("https://www.facebook.com") username=driver.find_element_by_id("email") username.send_keys("我的") passwd=driver.find_element_by_id("pass") passwd.send_keys("我的") button=driver.find_element_by_id("loginbutton") button. click() 我自己點到好友名單那 然後在執行下面 soup=BeautifulSoup(driver.page_source,"html5lib") for block in soup.select('._60ri fsl fwb fcb a'): print (block.text) 我是在jupyter上面執行,執行後沒出現錯誤訊息,但是也沒抓下任何資料 這是我要爬取目標 https://imgur.com/a/YVmrS7G 各位大大可以告訴我解決方法嗎謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.231.102.56 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1525001450.A.B45.html
pythongeek: 要讓爬蟲程式模擬登入Facebook帳號才能爬取 04/29 19:33
TitanEric: 我覺得如果要fb好友名稱接他提供的API比較好耶 如果要 04/29 20:35
TitanEric: 練習爬蟲可以考慮爬別的 04/29 20:35
earlywinter: 爬蟲程式指的是甚麼呢?我是用selenium模擬登入的 04/29 20:52
earlywinter: 我其實想爬的是公開社團成員的名稱和他們的好友名稱 04/29 20:53
earlywinter: FBAPI可以抓的到嗎?我之前試沒成功,可以請大大明示 04/29 20:55
pythongeek: fb網頁不登入帳號什麼都看不了,你程式沒登入fb 04/29 21:13
TakiDog: FB 最優秀就是API了 class名很奇怪八成都不能這樣做 04/29 22:47
earlywinter: 所以fbapi可以取得那些資料嗎?? 04/29 23:07