注册 登录
编程论坛 Python论坛

python 动态网页信息的爬取问题

zzn_kee 发布于 2019-09-24 16:19, 1865 次点击
学习的B站上关于动态网页爬取的内容,更换了需要提取的网址。显示的数据不对,不清楚是什么意思。与原教学内容不同的是,更改后的网址需要输入用户名密码。
import requests
import sqlite3
import json
from lxml import etree


def find():
    url = 'http://58.213.112.252:8115/yptrade/index.html'

    header = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}

    parmas = {
        '_search': 'false',
        'nd': '1569311443809',
        'rows': '10',
        'page': '1',
        'sord': 'asc',
    }
    response = requests.get(url, headers=header, params=parmas)
    result = response.text
    print(result)


find()

运行结果
C:\python3.6\python.exe C:/Users/Administrator/Desktop/python/猫眼爬虫/省平台.py
<script type='text/javascript'>top.location = 'http://58.213.112.252:8115/sso/login.html';</script>

Process finished with exit code 0
2 回复
#2
wp2319572019-09-25 09:13
回复 楼主 zzn_kee
最好用selenium 来做
#3
phiplato2020-04-25 07:19
都有params了,为什么还是get不是post
1