Python Forum
[Idea Required] How can i track any change on a webpage? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: [Idea Required] How can i track any change on a webpage? (/thread-17794.html)



[Idea Required] How can i track any change on a webpage? - Prince_Bhatia - Apr-24-2019

Hi,

i wish to write a python scripts which will have the ability to track webpage pages and if any change that will happen it will save those changes on csv.

Below are the things i am willing to implement but requires ideas:
1. A python script that can track changes
2. What are the libraries required
3. How to compare changes and get only thing that have changed?
4. How to display changes also?

any idea on it from where i can start would be helpful? Wall


RE: [Idea Required] How can i track any change on a webpage? - metulburr - Apr-24-2019

I would just pull the website html via requests module every X number of times (requests because its better than standard library stuff) and difflib module for comparing the two html to get the difference between them. difflib will return similar info like git about changes of a string. What was added/removed/etc. difflib even has an embedded html difference class difflib.HtmlDiff()