0

My goal is to get only the data from a specific table in a website. If possible, opened website could be run on the background preventing to pop-up.

I have tried Get page generated with Javascript in Python answer to apply, but it dumps all the data in the site rather than only the table. My best option is to parse it from there. As alternative I have tried How to extract tables from websites in Python answer but returned list object is empty.


As an example, I want to pull table (given information under the Symbol Size Entry_Price Mark_Price PNL) that is located at the bottom of the page from this site.

How can I achive this? While achieving it can the opened browser open on the background preventing the focus to itself?

alper
  • 2,919
  • 9
  • 53
  • 102

2 Answers2

-1

This code prints all HTML tables starting with index 0, 1, and so on...

tables1 = pd.read_html('https://www.binance.com/en/futuresng-activity/leaderboard/7E32B49490355C9FCCAA709A1D364AA6?tradeType=PERPETUAL')

tables1[0]

#or
#tables1[1]
#or
#tables[2]
-1

you can use BeuatifulSoup or bs4 with requests for example:

import requests
from bs4 import BeautifulSoup 

r=requests.get("") #url over here this will not open the browser
soup = BeautifulSoup(r.text, 'html.parser')
for table in soup.find_all('table'):
    print(table)

This code will print all the tables and then you can see the data and use if statements to come to a conclusion.