作者earlywinter (earlywinter)
看板Python
标题[问题]BeautifulSoup在print时一片空白
时间Sun Apr 29 19:30:47 2018
我想要爬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://webptt.com/cn.aspx?n=bbs/Python/M.1525001450.A.B45.html
1F:→ pythongeek: 要让爬虫程式模拟登入Facebook帐号才能爬取 04/29 19:33
2F:→ TitanEric: 我觉得如果要fb好友名称接他提供的API比较好耶 如果要 04/29 20:35
3F:→ TitanEric: 练习爬虫可以考虑爬别的 04/29 20:35
4F:→ earlywinter: 爬虫程式指的是甚麽呢?我是用selenium模拟登入的 04/29 20:52
5F:→ earlywinter: 我其实想爬的是公开社团成员的名称和他们的好友名称 04/29 20:53
6F:→ earlywinter: FBAPI可以抓的到吗?我之前试没成功,可以请大大明示 04/29 20:55
7F:→ pythongeek: fb网页不登入帐号什麽都看不了,你程式没登入fb 04/29 21:13
8F:→ TakiDog: FB 最优秀就是API了 class名很奇怪八成都不能这样做 04/29 22:47
9F:→ earlywinter: 所以fbapi可以取得那些资料吗?? 04/29 23:07