简体   繁体   English

如何使用 python 提取网站的全部数据?

[英]How to extract whole data of a website using python?

I am trying to read data of tables from the following website: https://cdn.ime.co.ir , using the following code:我正在尝试从以下网站读取表格数据: https://cdn.ime.co.ir ,使用以下代码:

import requests
import urllib.request
import time
from bs4 import BeautifulSoup

url = 'https://cdn.ime.co.ir'
response = requests.get(url)

soup = BeautifulSoup(response.text, "html.parser")

But when I check the content of soup the data of the tables that I need to read aren't in there!但是当我检查soup的内容时,我需要阅读的表格数据不在那里!

This is one of the tables that I like to read it's data that will be shown by clicking on it's above bar.这是我喜欢阅读其数据的表格之一,单击它上方的栏将显示该数据。

在此处输入图像描述

I would recommend you for getting the website data, start with a GET request instead of POST .我建议您获取网站数据,从GET请求而不是POST开始。

response = request.GET(<url>)

Differences between GET and POST GET 和 POST 之间的区别

After that, you should use beautifulsoup4 for analysing the data inside the response:之后,您应该使用 beautifulsoup4 来分析响应中的数据:

BS4 Documentation BS4 文件

Regards!问候!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM