【发布时间】:2019-07-30 13:50:35
【问题描述】:
我正在尝试从https://www.memrise.com/course/2021573/french-1-145/garden/speed_review/?source_element=ms_mode&source_screen=eos_ms 中删除一些文本,但是正如您所看到的,当它通过网络驱动程序加载链接时,它会自动将其重定向到登录页面。登录后直接跳转到我要抓取的页面,但是Beautiful Soup一直在抓取登录页面。
如何让 Beautiful Soup 抓取我想要的页面而不是登录页面?
我已经尝试在它刮擦之前输入一个time.sleep() 以便让我有时间登录,但这也没有用。
soup = BeautifulSoup(requests.get("https://www.memrise.com/course/2021573/french-1-145/garden/speed_review/?source_element=ms_mode&source_screen=eos_ms").text, 'html.parser')
while True:
front_half = soup.find_all(class_='qquestion qtext')
print(front_half)
time.sleep(1)
【问题讨论】:
-
如果它在服务器端处理(我看到它的方式)你不能做任何事情,因为服务器不会提供任何东西。除非您使用 GET 请求发送登录 cookie/..
-
请你再解释一下,我不明白你的意思
标签: python html web-scraping beautifulsoup