简体   繁体   English

Python脚本,当对网站进行更新时通知我。

[英]Python script that notifies me when a update is made to a website.

I need to make a script that will notify me when a change is made to a website. 我需要制作一个脚本,以便在对网站进行更改时通知我。 I am not sure about the best way to go about this and I don't know what python has that will be useful. 我不确定最好的方法,我不知道python有什么用处。 Any push in the right direction would be helpful. 任何正确方向的推动都会有所帮助。

You may use the last-modified date of the remote page : 您可以使用远程页面的上次修改日期:

import urllib
u = urllib.urlopen("http://www.google.com")
u.info().get("last-modified")

It all depends on what you define as an update to a website. 这完全取决于您定义的网站更新。

The simplest solution would be to use urllib2 to get the contents of the given website, storing it in a variable then quering the website again for contents and comparing them. 最简单的解决方案是使用urllib2获取给定网站的内容,将其存储在变量中,然后再次查询网站内容并进行比较。

Have that running in an infinite loop and you are set. 让它在无限循环中运行并且你已经设置好了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我想运行一个将我登录到网站的python脚本。 因此,当我使用浏览器访问网站时,我已经登录了 - I want to run a python script that logs me into a website. So when i go to the website using the browser i would already be logged in 我在本网站上的某个人的帮助下使用 KivyMD 在 Python 中制作了按钮。 这对他很有效,但对我来说有些不对劲 - I made button in Python using KivyMD with a help of some one in this website. It works perfectly for him, but for me something is wrong 抓取网站时缺少 HTML 元素。 Python - Missing HTML Elements when scraping website. Python 如何将文件上传到网站。 使用 python - How to upload files to a website. using python 我无法从该网站上抓取项目。 Python - I can not scrape item from this website. Python python 从网站下载。 目标机器主动拒绝 - python getting download from a website. the target machine actively refused it 我从官方网站安装了Python 3.6.0。 但是当我运行python时-我的bash shell上的版本是2.7.1。 我也不知道为什么 - I installed Python 3.6.0 from the official website. But when i run python — version on my bash shell .it say 2.7.1. And i don't know why 使用 Selenium 和 Python 抓取 Morningstar 网站。 Selenium 不会下载完整的网页 - Using Selenium and Python to scrape Morningstar website. Selenium doesn't download the full webpage 从仅具有网站网址的meta标签和img网址中提取值。 用python编写的Django应用程序 - extracting values from meta tags and img url having only url of website. Written in python for django app 如何更新用python制作的软件? - How to update software made with python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM