Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 当数据表未显示在页面源中时如何刮取_Python_Web Scraping_Beautifulsoup_Scrapy - Fatal编程技术网

Python 当数据表未显示在页面源中时如何刮取

Python 当数据表未显示在页面源中时如何刮取,python,web-scraping,beautifulsoup,scrapy,Python,Web Scraping,Beautifulsoup,Scrapy,我想从上的数据表中获取所有运行时间(不仅仅是前10个结果)。但是,网页上显示的数据不会显示在de页源中。每个数据表下都有一个超链接(“hier”)。这些链接指向完整的数据表页面。但这些链接也不在页面源中 任何关于如何刮取此数据的建议或代码片段(使用Python和BeautifulSoup或Scrapy)。您可以使用BeautifulSoup。第一: uClient = uReq(my_url) page_html = uClient.read() uClient.close() page_sou

我想从上的数据表中获取所有运行时间(不仅仅是前10个结果)。但是,网页上显示的数据不会显示在de页源中。每个数据表下都有一个超链接(“hier”)。这些链接指向完整的数据表页面。但这些链接也不在页面源中


任何关于如何刮取此数据的建议或代码片段(使用Python和BeautifulSoup或Scrapy)。

您可以使用BeautifulSoup。第一:

uClient = uReq(my_url)
page_html = uClient.read()
uClient.close()
page_soup = soup(page_html,"html.parser")
然后使用函数find.All(获取每个tr)。然后使用for循环,并键入
再次查找('td')以获取每一行

使用页面用于该内容的相同端点。您可以在浏览器的“网络”选项卡中找到它

import requests
from bs4 import BeautifulSoup as bs
import pandas as pd

r = requests.get('https://www.ijsselsteinloop.nl/uitslag/2019/index.html')
soup = bs(r.content, 'lxml')
links = ['https://www.ijsselsteinloop.nl/uitslag/2019/' + item['href'] for item in soup.select('[href^=uitslag]')]

for link in links:
    table = pd.read_html(link)[0]
    print(table)

谢谢,但这只返回每个数据表的前10行。每个数据表下都有一个超链接(“hier”)。这些链接指向完整的数据表页面。但是这些链接不在页面源代码中。Thnx,工作起来很有魅力!!LXML解析器是我“丢失的拼图”。