简体   繁体   English

如何使用 beautifulsoap 和 python __scrape__ 受密码保护的网站?

[英]How can I __scrape__ a password protected website using beautifulsoap and python?

https://khaiexch.com/ How can i scrape this website. https://khaiexch.com/我怎样才能抓取这个网站。 I am trying something like this but it is giving 403 as response我正在尝试这样的事情,但它给出了 403 作为响应

login_url = 'https://khaiexch.com/login/login_action'
login_data = {
    "email": "***", 
      "password": "****", 
    "compute": "****",
    "submitted": "****"
    }
r = requests.post(login_url, data=login_data)

But the above code is giviing me 403 error, Can any one please guide me how can I scrape this website?但是上面的代码给了我403错误,谁能指导我如何抓取这个网站?

Try requesting with get method and use headers aswell that would be something like this:尝试使用get方法请求并使用标头,这将是这样的:

import requests

login_url = 'https://khaiexch.com/login/login_action'
login_data = {
    "email": "***", 
    "password": "****", 
    "compute": "****",
    "submitted": "****"
    }
headers     = {'User-Agent': 'okhttp/3.12.1'}
r = requests.get(login_url, data=login_data, headers=headers)
result = r.status_code
print (result)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PYTHON 3 - 如何通过网络抓取受密码保护的网站? - PYTHON 3 - How to web scrape a password protected website? 使用python和beautifulsoap仅知道域链接时,如何获取网站的多个页面以抓取特定数据 - How to get multiple pages of a website to scrape specific data when only the domain link is known using python and beautifulsoap 如何抓取使用 BankID 登录 Python(BeautifulSoap,Requests)的网站? - How to scrape a website that's uses BankID for log in with Python (BeautifulSoap, Requests)? 刮刮密码保护的网站,没有令牌 - Scrape password protected website with no token 刮擦受密码保护的目录(使用python) - Scrape password protected directory (with python) 如何在 BeautifulSoap 中提取结果字符串? - How can I extract the result string in BeautifulSoap? Python 如何使用 BeautifulSoap? - Python how to use BeautifulSoap? 我如何在不被发现的情况下抓取网站并通过Python使用Selenium Webdriver绕过reCAPTCHA? - How can I scrape a website without getting detected and bypassing reCAPTCHA using selenium webdriver through Python? 如何使用没有 Selenium 的 Python 抓取源中不显示任何 HTML 代码的网站 - How can I scrape a website that does not show any HTML codes in the source using Python without Selenium 如何使用 Python 解压缩受密码保护的 zip 文件 - How do I unzip a password protected zip file using Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM