【问题标题】:how to get data from whoscored如何从whoscored获取数据
【发布时间】:2018-02-22 17:24:11
【问题描述】:

我需要从 whoscored.com 获取数据,但是当我输入此代码时

import requests
from bs4 import BeautifulSoup as soup
url = "https://www.whoscored.com/Statistics"
page_html = requests.get(url)
page_soup = soup(page_html.content, 'html.parser')

我正在获取 page_soup 变量如下

<html style="height:100%">
   <head>
  <meta content="NOINDEX, NOFOLLOW" name="ROBOTS"/>
  <meta content="telephone=no" name="format-detection"/>
  <meta content="initial-scale=1.0" name="viewport"/>
  <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
  <script src="/_Incapsula_Resource?
SWJIYLWA=2977d8d74f63d7f8fedbea018b7a1d05" type="text/javascript"></script>
   </head>
   <body style="margin:0px;height:100%"><iframe frameborder="0" 
height="100%" marginheight="0px" marginwidth="0px" 
src="/_Incapsula_Resource?CWUDNSAI=18&amp;xinfo=10-12988947-
0%200NNN%20RT%281505336855621%20883%29%20q%280%20-1%20-1%2077%29%20r%280%20-
1%29%20B15%284%2c200%2c0%29%20U2&amp;incident_id=473000610021824233-
81324132038935514&amp;edet=15&amp;cinfo=04000000" width="100%">Request 
unsuccessful. Incapsula incident ID: 473000610021824233-81324132038935514</iframe></body>

在这种情况下有什么方法可以获取数据吗?

【问题讨论】:

    标签: python-3.x python-requests html-parsing bs4


    【解决方案1】:

    whoscored.com 正在使用名为 incapsula 的基于云的应用程序交付平台,该平台通过以下方式为网络服务器提供安全功能:

    通过对您的网站 DNS 记录进行简单更改(无需硬件或软件),您的网站流量将通过 Incapsula 的全球分布式高性能服务器网络无缝路由。实时智能分析传入流量,阻止最新的网络威胁(例如,SQL 注入攻击、抓取工具、恶意机器人、垃圾评论发送者)并阻止三位数的千兆位 DDoS 攻击。同时,通过 Incapsula 的全球 CDN 加速和优化传出流量,以缩短加载时间,让受欢迎的访客保持快速通过。

    来源:https://www.incapsula.com/faqs/

    如您在 html 正文中所见,您的 http 请求被阻止:

    Request unsuccessful. Incapsula incident ID: 473000610021824233-81324132038935514
    

    你想要做的是绕过封装。有 python 模块可以帮助你:https://github.com/ziplokk1/incapsula-cracker-py3

    我建议仔细查看issue #4,因为您可能需要做一些额外的工作才能绕过封装。

    【讨论】:

      猜你喜欢
      • 2020-01-29
      • 2021-02-10
      • 2018-12-25
      • 2023-03-26
      • 2019-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多