Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Python注释掉的部分解析HTML_Python_Html_Beautifulsoup - Fatal编程技术网

从Python注释掉的部分解析HTML

从Python注释掉的部分解析HTML,python,html,beautifulsoup,Python,Html,Beautifulsoup,我正在尝试使用请求和BeautifulSoup从该页面上的games_played_team表中获取数据 url = "http://www.pro-football- reference.com/teams/nwe/2016_roster.htm" r = requests.get(url) soup = BeautifulSoup(r.content) print soup.prettify() 返回 <!DOCTYPE html> <html data-version

我正在尝试使用请求和BeautifulSoup从该页面上的games_played_team表中获取数据

url = "http://www.pro-football-
reference.com/teams/nwe/2016_roster.htm"
r = requests.get(url)

soup = BeautifulSoup(r.content)
print soup.prettify()
返回

<!DOCTYPE html>
<html data-version="klecko-" data-root="/home/pfr/build" 
itemscope="itemscope" itemtype="http://schema.org/WebSite" lang="en" class="no-js">
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0" />
  <link rel="dns-prefetch" href="https://d2p3bygnnzw9w3.cloudfront.net/req/201706021" />
  <link href="https://d2p3bygnnzw9w3.cloudfront.net" rel="preconnect" crossorigin="crossorigin" />
  <link href="http://d9kjk42l7bfqz.cloudfront.net/req/201607120" rel="preconnect" crossorigin="crossorigin" />
  <link href="https://www.google-analytics.com/" rel="preconnect" crossorigin="crossorigin" />
  <link href="https://www.googletagservices.com" rel="preconnect" crossorigin="crossorigin" />
  <script class="allowed">
   var sr_is_production = true;
function vjs_ready(e){"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)}var log_performance=!1,sr_detect_operaMini=navigator.userAgent.indexOf("Opera Mini")&gt
;-1;if(sr_detect_operaMini){var el=document.querySelector("html");el.className=el.className.concat(" operamini")}var sr_detect_firefox=navigator.userAgent.indexOf("Firefox")&gt;-1;if(sr_detect
_firefox){var el=document.querySelector("html");el.className=el.className.concat(" firefox")}var sr_detect_firefoxMobile=navigator.userAgent.indexOf("Firefox")&gt;-1&amp;&amp;(navigator.userAg
ent.indexOf("Mobile")&gt;-1||navigator.userAgent.indexOf("Tablet")&gt;-1);if(sr_detect_firefoxMobile){var el=document.querySelector("html");el.className=el.className.concat(" firefox-mobile")}
var sr_detect_ie=function(){var e=window.navigator.userAgent;if(e.indexOf("Trident/7.0")&gt;0)return 11;if(e.indexOf("Trident/6.0")&gt;0)return 10;if(e.indexOf("Trident/5.0")&gt;0)return 9;for
(var t=3,n=document.createElement("div"),r=n.getElementsByTagName("i");n.innerHTML="&lt;!--[if gt IE "+ ++t+"]&gt;&lt;i&gt;&lt;/i&gt;
&lt;link rel="shortcut icon" href="https://d2p3bygnnzw9w3.cloudfront.net/req/201706021/favicons/pfr/favicon.ico"&gt;
  </script>
 </head>
</html>

当我查看实际的页面源代码时,我想要的表似乎位于HTML的注释块中。我不完全确定如何继续,如果您能帮助我更改请求,我将不胜感激。或者,如果您想要另一个简单的解决方案,您可以使用Selenium。

我猜这是一个加载了javascript的表。在youtube或其他网站上查找selenium和phantomJS您希望恢复哪些特定信息?