Can scraping be applied to this page which is actively recalculating?

南笙酒味 提交于 2019-12-04 15:28:17

One option would be to fire up a real browser and continuously poll the position in an endless loop:

import time
from selenium import webdriver

driver = webdriver.Firefox()
driver.get("http://www.satview.org/?sat_id=41186U")


while True:
    location = driver.find_element_by_css_selector("#sat_latlon .texto_track2").text
    latitude, longitude = location.split("\n")[:2]

    print(latitude, longitude)

    time.sleep(1)

Sample output:

(u'-16.57', u'66.63')
(u'-16.61', u'66.67')
...

Here we are using selenium and Firefox - there are multiple drivers for different browsers including headless, like PhantomJS.

no need to scrape. Just look at the source html of that page and copy/paste the javascript code. None of the positions are fetched remotely...they're all calculated on the fly in the page. So just grab the code and run it yourself!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!