Web Scraping ~ Python

I'm new to python and want some help regarding Web Scraping.

I have a Raspberry Pi3 with python on it and i want to extract some data from a web page using BeautifulSoap and write it to a text file with a time stamp, i keep my Pi 24x7 on so i want the python to repeat itself after a certain time interval so that i can later create a graph using those values.

Ok, you got the soup part right but you are looking only at the first td element.

You need to find the exact one that you want.
In this case, it's the first td inside the second tr with left alignment (there are several ways to get there, this was the one I found easier)

In this case you can use:

tr = bsObj.find_all('tr', align='left')[1] # find_all returns all the elements in a list
td = tr.find('td') # find returns only the first element in that block
text = td.get_text() # we want the text, not the whole tag

I believe that you can work out the timestamp using the datetime module.
datetime has an option to create a string the way you want, you can see all the options here

One example, without the miliseconds, would be:

now = datetime.datetime.now()
timestamp = now.strftime('%d/%m - %Hh%M') # Note that you can add your own text with the time directives.

To write the output you have several options, you can start by looking here

Finally, the easiest way to repeat every X seconds is to put everything in a while loop with a sleep(X) in the end. Let's pretend you created a magic function with all the scrap and file I/O and that you want to run every 60s.

You have two options now:

1) An infinite loop that keeps going no matter what (you need to manually break it with ctrl+c or by itself when an error occurs.

while True:
do_your_magic()
sleep(60)

2) A slightly better option would be to find out when the download is over (i.e. the remaining is zero or the page changes), but this depends on how your page source would behave when the download is over. For that you could have your magic function returning False while downloading and True when it's done and your loop could become:

while True:
done = do_your_magic()
if done:
break
sleep(60)

or, more directly:

while not do_your_magic():
sleep(60) # This runs your magic and breaks when it's done.

Have a try, if you need more help just tell us how far you've got and what you think you're missing...