使用Python动态表格抓取数据

时间:2021-06-10 22:43:02

标签: python selenium beautifulsoup

我正在尝试使用 Python 从阿拉伯网站抓取动态股票信息:

https://www.boursakuwait.com.kw/ar/securities/prices-and-screens/market-watch

但是,我是 Python 的新手。那么有人可以帮我吗?非常感谢。

我想做的就是从上述网站抓取 HTML 动态数据。

我尝试了很多代码,这是最后一个,给我一些数据

import pandas as pd
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
import time

driver = webdriver.Firefox()
driver.get("https://www.boursakuwait.com.kw/ar/securities/prices-and-screens/market-watch")
time.sleep(20)
wait = WebDriverWait(driver, 10)
links = driver.find_element_by_id('table-1-1-1-11')
data = links.text

print(data)

它给了我一些数据而不是网站表格中的数字

حجم التداول
التغير%
التغير
السعر الحالي
حجم العرض
العرض
حجم الطلب
الطلب
أدنى
أعلى
إفتتاح
السابق
الفترة
الاسم
اسم السهم
رقم السهم



0
0
0.00
0.000
٠
0
٠
0
٠
٠
٠
٠
٠
اقفال اليوم
بنك الكويت الوطني
وطني
101



0
0
0.00
0.000
٠
0
٠
0
٠
٠
٠
٠
٠
اقفال اليوم
بنك الخليج ش.م.ك.ع
خليج ب
102



0
0
0.00
0.000
٠
0
٠
0
٠
٠
٠
٠
٠
اقفال اليوم
بنك الكويت الدولي
الدولي
106



0

this is the table i want from the website

0 个答案:

没有答案