Get a page's last modified date using Java

前端 未结 2 824
野性不改
野性不改 2021-01-22 04:14

Is there a standard way to tell when a page was last modified? Currently I am doing this:

URLConnection uCon = url.openConnection();
uCon.setConnectTimeout(500         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-22 04:34

    There is no standard. Dynamically generated web pages generally do not have a Last-Modified field, and different web pages include dates in different ways. Some sites do not even include such a date, including "© " at the bottom. You could try looking for a date near the bottom or the top, but reliably extracting the date from the web page would have to be site-specific.

提交回复
热议问题