How I see the code of an already interpreted html page

Asked

Viewed 74 times

0

When I make a request in an HTML page with Python I get the source code , but if I access the page and go to see the code of the page by the options of developers I have there a totally different code with the HTML already built .

I need this HTML code, preferably built in Python .

The page I want to get that is https://www.wunderground.com/history/daily/SBBV/date/2019-2-3 . I’m changing the date to get the climate history of the last 15 years for a college project .

  • Pq does not use their API?

  • @Jakson-Fischer I searched the site the API and did not find , give me the link , please

  • API

2 answers

0


Something like this can be done in Python with the library Selenium, the code would look something like this:

from selenium import webdriver

browser = webdriver.Firefox()
browser.get('https://www.wunderground.com/history/monthly/SBBV/date/2019-2')
html = browser.page_source
browser.quit()

print(html)

You can find the official documentation of the Python library in this link.

  • Thanks so much @lacobus , I just had time to test today and it really worked, thanks so much .

0

This is because the page is dynamic. It is built with javascript and/or frameworks like : angular, vueJs, reactJs, etc...

HTML is built upon entering the screen, most likely in the document’s onload, thus calling your services and getting the data to build the page.

When vc executes a request to get the page content, it will only return the HTML base with the javascript building code of the layout.

I hope you understand.

  • Yes, I understood , I imagined it was something like , thank you very much , but I’m looking to see the code already interpreted

Browser other questions tagged

You are not signed in. Login or sign up in order to post.