Blogging Reminder Nag Script
I will admit that I have trouble from time to time remembering to keep my blog active and publish frequently. Compounding the problem is that I have many 10s of blogs out there that have become stale and effectively dead due to lack of attention. To help solve this problem I’ve put together a simple nagging script that I have scheduled which checks a bunch of my sites to see how fresh the content is. Once it breaks a specified threshold for the number of days since the last post I get a nagging email reminding me to write something for the site.
#!/usr/bin/env python # -*- coding: utf-8 -*- # (C) 2010 HalOtis Marketing # written by Matt Warren # http://halotis.com/ import feedparser # available at feedparser.org import gmail import datetime import re SETTINGS = [{'name':'yourblog.com', 'url':'http://www.example.com/feed/', 'email':'YOUR EMAIL', 'frequency':'3'}, ] today = datetime.datetime.today() def check_blog(blog): d = feedparser.parse(blog['url']) lastPost = d.entries[0] pubDate = datetime.datetime( lastPost.modified_parsed[0], lastPost.modified_parsed[1], lastPost.modified_parsed[2], lastPost.modified_parsed[3], lastPost.modified_parsed[4], lastPost.modified_parsed[5]) if today - pubDate > datetime.timedelta(days=7): print "send email - last post " + str((today-pubDate).days) + " days ago." gmail.send_email(blog['name'] + ' needs attention! last post ' + str((today-pubDate).days) + " days ago.", 'Please write a post', to_addr=blog['email']) else: print "good - last post" + str((today-pubDate).days) + " days ago." if __name__ == '__main__': for blog in SETTINGS: check_blog(blog)
I’ve added this script to the halotis-collection on bitbucket.org if your interested in pulling it from there.


No comments yet.