I'm trying to extract the first ISS TLE (Two Line Element set) from this website.
I need the first three lines following the:
TWO LINE MEAN ELEMENT SET
text: (ISS line, 1 line, 2 line).
So I get the text that has what I want using beautiful soup, but then I don't really know how to extract those lines of text. I can't use split() because I need to exactly maintain the white space in those three lines. How can this be done?
import urllib2
from bs4 import BeautifulSoup
import ephem
import datetime
nasaissurl = 'http://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/orbit/ISS/SVPOST.html'
soup = BeautifulSoup(urllib2.urlopen(nasaissurl), 'html.parser')
body = soup.find_all("pre")
index = 0
firstTLE = False
for tag in body:
if "ISS" in tag.text:
print tag.text