[問題]BeautifulSoup在print時一片空白

作者: earlywinter (earlywinter)   2018-04-29 19:30:47
我想要爬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
各位大大可以告訴我解決方法嗎謝謝
作者: pythongeek   2018-04-29 19:33:00
要讓爬蟲程式模擬登入Facebook帳號才能爬取
作者: TitanEric (泰坦)   2018-04-29 20:35:00
我覺得如果要fb好友名稱接他提供的API比較好耶 如果要練習爬蟲可以考慮爬別的
作者: earlywinter (earlywinter)   2018-04-29 20:52:00
爬蟲程式指的是甚麼呢?我是用selenium模擬登入的我其實想爬的是公開社團成員的名稱和他們的好友名稱FBAPI可以抓的到嗎?我之前試沒成功,可以請大大明示
作者: pythongeek   2018-04-29 21:13:00
fb網頁不登入帳號什麼都看不了,你程式沒登入fb
作者: TakiDog (多奇狗)   2018-04-29 22:47:00
FB 最優秀就是API了 class名很奇怪八成都不能這樣做
作者: earlywinter (earlywinter)   2018-04-29 23:07:00
所以fbapi可以取得那些資料嗎??

Links booklink

Contact Us: admin [ a t ] ucptt.com