python - 跳转到下一页时 url 不会改变

标签 python web-scraping

嗨~我只是想从页面获取一些数据。 我想以编程方式导航到该页面。 但是当我转到下一页时,该页面的网址不会改变。 该网站是http://goodauction.land.naver.com/auction/ca_list.php

不知道为什么 我该如何解决这个问题?

最佳答案

每次单击下一页链接时,它都会将数据发送到服务器。 enter image description here

您可以模仿 post 使用请求库。

import requests, bs4
payload = {
        'lawsup':0,
        'lesson':0,
        'next_biddate1':'',
        'next_biddate2':'',
        'state':91,
        'b_count1':0,
        'b_count2':0,
        'b_area1':'',
        'b_area2':'',
        'special':0,
        'e_area1':'',
        'e_area2':'',
        'si':11,
        'gu':0,
        'dong':0,
        'apt_no':0,
        'order':'',
        'start':60,
        'total_record_val':850,
        'detail_search':'',
        'detail_class':'',
        'recieveCode':'',}
headers = {'User-Agent':'Mozilla/5.0', 
          'Referer':'http://goodauction.land.naver.com/auction/ca_list.php'}
r = requests.post('http://goodauction.land.naver.com/auction/ax_list.php', data=payload, headers=headers)
print(r.text)

虽然字段很多,但是页面都在start字段中: 你可以直接发帖:

payload = {
        'state':91,
        'start':30,  # each page contains 30 record, next page +30 example: 0, 30, 60
        'total_record_val':850,}

关于python - 跳转到下一页时 url 不会改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42088808/

相关文章:

python - 向 sys.excepthook 添加函数

javascript - 如何使用 python 解析 Javascript 变量?

xpath - Python 和 Scrapy 不能很好地处理格式错误的 HTML

python - 在 docker 容器中运行 python 脚本时没有 json 模块

python - psycopg2 无法连接到 docker 镜像

python - 用 Pandas 调整子图布局

python - 更新 JPEG 文件中的 JFIF 缩略图

php - CURL 正在返回垃圾

python - 您如何查看 mechanize 使用的请求 header ?

通过 VBA/Excel 提取 HTML