简体   繁体   English

使用 python 请求和 BeautifulSoup 从带有框架或 flexbox 的网站中抓取数据

[英]Scrape data from website with frames or flexbox using python requests and BeautifulSoup

I've been trying to figure this out but with no luck.我一直试图弄清楚这一点,但没有运气。 I found a thread ( How to scrape data from flexbox element/container with Python and Beautiful Soup ) that I thought would help but I can't seem to make any headway.我发现了一个线程( How to scrape data from flexbox element/container with Python and Beautiful Soup )我认为这会有所帮助,但我似乎无法取得任何进展。

The site I'm trying to scrape is...http://www.northwest.williams.com/NWP_Portal/.我要抓取的网站是...http://www.northwest.williams.com/NWP_Portal/。 In particular I want to get the data from the tab/frame of 'Storage Levels' but for the life of me I can't seem to navigate to the right spot to get the data.特别是我想从“存储级别”的选项卡/框架中获取数据,但对于我来说,我似乎无法导航到正确的位置来获取数据。 I've tried various iterations of the code below with no success.我已经尝试了下面代码的各种迭代,但没有成功。 I've changed 'lxml' to 'html.parser', looked for tables, looked for 'tr' etc but the code always returns empty.我已将“lxml”更改为“html.parser”,查找表,查找“tr”等,但代码始终返回空。 I've also tried looking at the network info but when I click on any of the tabs (System Status, PAL/System Balancing etc) I don't see any change in network activity.我也试过查看网络信息,但是当我点击任何选项卡(系统状态、PAL/系统平衡等)时,我看不到网络活动有任何变化。 I'm sure it's something simple that I'm overlooking but I just can't put my finger on it.我敢肯定,我忽略了一些简单的事情,但我就是不能把手指放在上面。

from bs4 import BeautifulSoup as soup
import requests

url = 'http://www.northwest.williams.com/NWP_Portal/'

r = requests.get(url)

html = soup(r.content,'lxml')

page = html.findAll('div',{'class':'dailyOperations-panels'})

How can I 'navigate' to the 'Storage Levels' frame/tab?如何“导航”到“存储级别”框架/选项卡? What is the html that I'm actually looking for?我真正在寻找的 html 是什么? Can I do this with just requests and beautiful soup?我可以只用请求和漂亮的汤来做到这一点吗? I'm not opposed to using Selenium but I haven't used it before and would prefer to just use requests and BeautifulSoup if possible.我不反对使用 Selenium 但我以前没有使用过它,如果可能的话,我宁愿只使用请求和 BeautifulSoup。

Thanks in advance!提前致谢!

Hey so what I notice is your are trying to get "dailyOperations-panels" from a div which won't work.嘿,所以我注意到你正试图从一个不起作用的 div 中获取“dailyOperations-panels”。

暂无
暂无

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

相关问题 使用python和beautifulsoup从网站数据抓取到csv文件格式 - Data Scrape from a website to a csv file format using python and beautifulsoup Beautifulsoup Python 无法从网站上抓取数据 - Beautifulsoup Python unable to scrape data from a website 使用 beautifulsoup 从网站上抓取数据 - 嵌套 - Using beautifulsoup to scrape data from a website - nested 如何使用 Python REQUESTS 和 BeautifulSoup 抓取基于动态 JavaScript 的网站? - How to scrape Dynamic JavaScript based website using Python REQUESTS and BeautifulSoup? Python-如何使用“ requests&BeautifulSoup”抓取Tr / Td表数据 - Python - How to scrape Tr/Td table data using 'requests & BeautifulSoup' 如何使用BeautifulSoup,Requests和Python从HTML的特定表中抓取数据? - How to scrape data from a specific table in HTML using BeautifulSoup, Requests, Python? 如何使用python中的BeautifulSoup库从具有“查看更多”选项的网站上抓取数据 - How to scrape data from website having “View More” option using BeautifulSoup library in python 如何使用 BeautifulSoup 从 python 网站中的未加载选项卡中抓取表数据 - How to scrape table data from an unloaded tab in a website in python using BeautifulSoup 如何在python中使用硒和beautifulsoup从网站上抓报纸? - How to scrape newspaper articles from website using selenium and beautifulsoup in python? 需要使用 xpath 和 beautifulsoup 从网站上抓取数据 - Need to scrape a data from a website using xpath and beautifulsoup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM