我正试图解析来自这个网站的json表中的数据
url-https://boxes.mysubscriptionaddiction.com/subscription_boxes_for/food
我主要需要列出的所有食品订购箱的名称、等级和说明。我在这里面临一些挑战。一个是表有两个视图-网格视图和列表视图。如何指定代码中引用的表视图?第二个是我得到了一份工作
ValueError - Timeout value connect was Timeout(connect=<object object at 0x000002767CECD5C0>,
read=<object object at 0x000002767CECD5C0>, total=None), but it must be an int, float or None.
不确定这意味着什么。
我的代码:
from pandas.io.html import read_html
from selenium import webdriver
import json
import requests
import os
import sys
from bs4 import BeautifulSoup
import requests
driver = webdriver.Firefox(executable_path='C:\Drivers\geckodriver.exe')
driver.get('https://boxes.mysubscriptionaddiction.com/subscription_boxes_for/food')
table = driver.find_element_by_xpath('/html/body/div[3]/div/span/div[2]/div/div[1]/div[3]/div[3]/table')
table_html = table.get_attribute('innerHTML')
bs = BeautifulSoup(table_html, 'html.parser')
rows = bs.select('tbody tr')
print(bs)
下面是如何获取您要查找的数据:(
data
是包含信息的dict)相关问题 更多 >
编程相关推荐