首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Python Web抓取重定向到其他页面的页面

Python Web抓取重定向到其他页面的页面
EN

Stack Overflow用户
提问于 2018-06-09 07:09:08
回答 1查看 1K关注 0票数 1

我在抓取网页内容时遇到了困难。

为了解释这一点,下面是我的Python代码:

代码语言:javascript
复制
response = requests.post('http://a836-acris.nyc.gov/bblsearch/bblsearch.asp?borough=1&block=733&lot=66',{'User-Agent' : 'Mozilla/5.0'})

这给了我一个包含表单(不包含最后一个页面)的页面:

代码语言:javascript
复制
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>

    <form name="bbldata" action="https://a836-acris.nyc.gov/DS/DocumentSearch/BBLResult" method="post">
    <input type="hidden" name="hid_borough" value="1"/>
    <input type="hidden" name="hid_borough_name" value="MANHATTAN / NEW YORK" />
    <input type="hidden" name="hid_block" value="733"/>
    <input type="hidden" name="hid_block_value" value="733"/>
    <input type="hidden" name="hid_lot" value="66"/>
    <input type="hidden" name="hid_lot_value" value="66"/>
    <input type="hidden" name="hid_unit" value=""/>
    <input type="hidden" name="hid_selectdate" value=""/>
    <INPUT TYPE="HIDDEN" NAME="hid_datefromm"  VALUE="">
    <INPUT TYPE="HIDDEN" NAME="hid_datefromd"  VALUE="">
    <INPUT TYPE="HIDDEN" NAME="hid_datefromy"  VALUE="">
    <INPUT TYPE="HIDDEN" NAME="hid_datetom"  VALUE="">
    <INPUT TYPE="HIDDEN" NAME="hid_datetod"  VALUE="">
    <INPUT TYPE="HIDDEN" NAME="hid_datetoy"  VALUE="">
    <input type="hidden" name="hid_doctype" value=""/>
    <input type="hidden" name="hid_doctype_name" value="All Document Classes"/>
    <input type="hidden" name="hid_max_rows" value="10"/>
    <input type="hidden" name="hid_page" value="1" />
    <input type="hidden" name="hid_ReqID" value=""/>
    <input type="hidden" name="hid_SearchType" value="BBL"/>
    <input type="hidden" name="hid_ISIntranet" value="N"/>    
    <input type="hidden" name="hid_sort" value=""/>    
    </form>

<script language="JavaScript">
    document.bbldata.submit();
</script>
</body>
</html>

但是,如果您在浏览器中输入此url,则在加载了中的脚本之后,您最终会得到此网页,并且必须抓取此网页:

任何帮助都将不胜感激!

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50769439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档