不知道为什么我不能从这个链接获取页面。我想做的就是把它拿到美丽之群。你知道吗
import requests,urllib2
link='https://www.sec.gov/ix?doc=/Archives/edgar/data/1373715/000137371518000157/now-2018630x10q.htm'
r = requests.get(link)
r2=urllib2.urlopen(link)
html=r2.read()
还尝试用以下内容伪造浏览器:
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
r = requests.get(link, headers=headers)
文本相同。。。不是我想要的那一页。你知道吗
得到这样的标题
var note = 'The browser mode you are running is not compatible with this application.';
browserName ='Microsoft Internet Explorer';
note +='You are currently running '+browserName+' '+((ie7>0)?7:8)+'.0.';
var userAgent = window.navigator.userAgent.toLowerCase();
if(userAgent.indexOf('ipad') != -1 || userAgent.indexOf('iphone') != -1 || userAgent.indexOf('apple') != -1){
note += ' Please use a more current version of '+browserName+' in order to use the application.';
}else if(userAgent.indexOf('android') != -1){
note += ' Please use a more current version of Google Chrome or Mozilla Firefox in order to use the application.';
}else{
note += ' Please use a more current version of Microsoft Internet Explorer, Google Chrome or Mozilla Firefox in order to use the application.';
}
我可以很好地完成这一页:
https://www.sec.gov/Archives/edgar/data/1373715/000137371518000153/erq2fy18-document.htm
不是XBRL文档。我认为这与XBRL有关,服务器希望我的浏览器与数据交互?你知道吗
页面的这部分似乎是由js呈现的。通常动态内容最可靠的选项是
selenium
,但在这种情况下,您可以避免使用它并使用requests
。你知道吗很明显,页面使用了这个文档的内容
/Archives/edgar/data/1373715/000137371518000157/now-2018630x10q.htm
。您可以绕过该页直接请求文档。你知道吗相关问题 更多 >
编程相关推荐