Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16536

I want to store the headers of the table using web-scraping [closed]

$
0
0

To keep it short, I'm trying to web-scrape table headers located in the table when you go to the other page using Scorecard column links. The idea is the code should store all the headers from each and every links in the Scorecard column to a json file.

I first tried to store the contents of the Match Results in the json file which executed pretty well. Although when I pushed the code further and tried to get the headers using the links in the Scorecard column it just printed the else statement of file batting_page.py "Failed to retrieve the table", while storing the content extracted by loading_content.py file in a json file.

I've provided my code's snippet for your reference.

First link/Match Results = "https://www.espncricinfo.com/records/year/team-match-results/2023-2023/twenty20-internationals-3"

loading_content.pybatting_page.py

For example -

If you navigate to the first link in the Scorecard column and click the first link, you'll see headers ["Batting", "R", "B", "4s", "6s", "SR"]. This headers are the one's that I want to add to my json file. I know the json file will have multiple entries of the same headers but it's fine just wanna check if it is a problem with dynamic loading of javascript pages or what!!


Viewing all articles
Browse latest Browse all 16536

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>