Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to read data of tables from the following website: https://cdn.ime.co.ir , using the following code:
Python
import requests
    import urllib.request
    import time
    from bs4 import BeautifulSoup
    
    url = 'https://cdn.ime.co.ir'
    response = requests.get(url)
    
    soup = BeautifulSoup(response.text, "html.parser")

But when I check the content of `soup` the data of the tables that I need to read aren't in there!

This is one of the tables that I like to read it's data that will be shown by clicking on it's above bar.

https://i.stack.imgur.com/Ty53g.png[^]

What I have tried:

I wrote what I did into the question.
Posted
Updated 29-Feb-20 23:18pm

1 solution

Chances are high that the tables are dynamically loaded by some JavaScript code on the website. But that still means that there has to be a network request that you can make to fetch the data. Open your browser's web developer tools, switch to the Network tab, and see if there are any requests that load these tables. Inspect the content of those and see how you can parse those in your Python script.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900