Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract data from a webpage
#1
Hello all;

I'm would like to ask some advices to the python community concerning a script I'm trying to develop.

In fact, I'm living near a lake in Italy, and from time to time the water level is very close from my house, so I'm looking a way to pick-up a value from a webpage dealing with the lake level, and sending me notification when this level reach a high value.

The webpage giving the value is this one : https:www.astrogeo.va.it/idro/idro.php

the value I want to retrieve is the one after "Stazione di Leggiuno", by example today : 194.12, as indicated on the website.

Using examples found on the web, I used Request and beautifulsoup to retrieve this info :

#!/usr/bin/python
import requests
from bs4 import BeautifulSoup

# using the requests module, we use the "get" funtion
result = requests.get("https:www.astrogeo.va.it/idro/idro.php")

print(result.status_code)

# let us store the page content of the website
# from requests to a variable

src = result.content
print(src)
so, I receive the 'result' on my screen, with the data I want to import :
Quote:document.getElementById("Livello').InnerHTML="<strong>Stazione di Leggiuno: "+data.legb.livello[ data.legb.livello.lenght-1]+"<font color='#417 FDA'>

I'was thinking that the value I wanted to extract should be just after the mark "Stazione di Leggiuno", but instead, I got this "+data.legb.livello", and cannor recover the result displayed on the webpage (in this case 194.12).

Anyone of the python community has been face to this problem ? how is it possible to retrieve the numerical value , if possible ?

Many thanks in advance for your help !
Reply


Messages In This Thread
Extract data from a webpage - by cycloneseb - Nov-12-2019, 10:20 AM
RE: Extract data from a webpage - by Larz60+ - Nov-12-2019, 12:42 PM
RE: Extract data from a webpage - by cycloneseb - Nov-12-2019, 01:15 PM
RE: Extract data from a webpage - by Larz60+ - Nov-12-2019, 04:46 PM
RE: Extract data from a webpage - by snippsat - Nov-12-2019, 05:25 PM
RE: Extract data from a webpage - by alekson - Apr-04-2020, 10:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to extract links from grid located on webpage Pavel_47 5 1,474 Aug-04-2023, 12:43 PM
Last Post: Gaurav_Kumar
  Extract data from sports betting sites nestor 3 5,664 Mar-30-2021, 04:37 PM
Last Post: Larz60+
  Extract data from a table Bob_M 3 2,700 Aug-14-2020, 03:36 PM
Last Post: Bob_M
  Extract data with Selenium and BeautifulSoup nestor 3 3,938 Jun-06-2020, 01:34 AM
Last Post: Larz60+
  Want to extract 4 tables from webpage - Nubee Stuck :( andrewjmdata1 0 1,742 Apr-19-2020, 05:42 PM
Last Post: andrewjmdata1
  Extract json-ld schema markup data and store in MongoDB Nuwan16 0 2,477 Apr-05-2020, 04:06 PM
Last Post: Nuwan16
  Cannot Extract data through charts online AgileAVS 0 1,854 Feb-01-2020, 01:47 PM
Last Post: AgileAVS
  Cannot extract data from the next pages nazmulfinance 4 2,815 Nov-11-2019, 08:15 PM
Last Post: nazmulfinance
  How to use Python to extract data from Zoho Creator software on the web dan7055 2 4,021 Jul-05-2019, 05:11 PM
Last Post: DeaD_EyE
  Python/BeautiifulSoup. list of urls ->parse->extract data to csv. getting ERROR IanTheLMT 2 3,993 Jul-04-2019, 02:31 AM
Last Post: IanTheLMT

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020