| #!/usr/bin/env python3 | |
| import json | |
| import requests | |
| from bs4 import BeautifulSoup | |
| response = {} | |
| request = requests.get('http://bedanec.agotech.com/AIS/AIS.PHP') | |
| data = BeautifulSoup(request.text, 'html.parser') | |
| rows = data.find_all('tr') | |
| for row in rows: | |
| d = row.find_all('td') | |
| response[d[1].text] = {'name': d[0].text, | |
| 'mmsi': d[1].text, | |
| 'call': d[2].text, | |
| 'imo': d[3].text, | |
| 'nav_status': d[4].text, | |
| 'cog': d[5].text, | |
| 'speed': d[6].text, | |
| 'lon': d[7].text, | |
| 'lat': d[8].text, | |
| 'length': d[9].text, | |
| 'width': d[10].text, | |
| 'draft': d[11].text, | |
| 'type': d[12].text, | |
| 'destination': d[13].text, | |
| 'eta': d[14].text, | |
| 'last_update': d[15].text} | |
| print(json.dumps(response)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment