Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions orbit/tle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
requests_cache.install_cache(expire_after=86400)

def get(catnr):
page = html.fromstring(requests.get('http://www.celestrak.com/cgi-bin/TLE.pl?CATNR=%s' % catnr).text)
tle = page.xpath('//pre/text()')[0].split('\n')
return tle[1].strip(), tle[2].strip(), tle[3].strip()
page = html.fromstring(requests.get('http://www.celestrak.com/NORAD/elements/gp.php?CATNR=%s' % catnr).text)
tle = page.xpath('//p/text()')[0].split('\n')
return tle[0].strip(), tle[1].strip(), tle[2].strip()

def parse(name, line1, line2):
tle_rec = ephem.readtle(name, line1, line2)
tle_rec.compute()
return tle_rec
return tle_rec