1

I am trying to scrape a table through from a website but i am getting NULL.

How can i get the table? What am i doing wrong?

import requests
from bs4 import BeautifulSoup

html = "https://traderslounge.in/implied-volatility-rank-nse-fno-stocks/" #link that has to be scrapped

response = requests.get(url) # before we feed it to request to parse 

response.status_code
soup = BeautifulSoup(response.text, 'html.parser')

table = soup.find_all("th")
list_of_rows = []
for row in table.findAll("td"):
    list_of_cells = []
    for cell in row.findAll(["th","td"]):
        text = cell.text
        print(text)
        list_of_cells.append(text)
        list_of_rows.append(list_of_cells)

for item in list_of_rows:
    print(' '.join(item))
1
  • Scrape, not scrap! Commented Oct 26, 2019 at 22:56

1 Answer 1

2

The table content of this site is retrieved from an external API :

https://traderslounge.in/FNO/ivrank/ivranktable.txt

You can get the result using :

import requests

r = requests.get('https://traderslounge.in/FNO/ivrank/ivranktable.txt')

print(r.json()["data"])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.