Created
June 1, 2014 07:16
-
-
Save roadsideseb/a1d60a23c7a2c07f3f9d to your computer and use it in GitHub Desktop.
What does the MobifyBlog say about what an employee at Mobify is called?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import re | |
import feedparser | |
from collections import defaultdict | |
MOBIF_REGEX = re.compile(r'(?i)mobif\w+') | |
def main(): | |
feed = feedparser.parse('http://feeds.feedburner.com/MobifyBlog') | |
terms = defaultdict(int) | |
for entry in feed.entries: | |
try: | |
found = MOBIF_REGEX.findall(entry.summary_detail.value) | |
except AttributeError: | |
continue | |
for term in found: | |
terms[term.lower()] += 1 | |
print("Here are the stats:") | |
print() | |
for term, count in terms.items(): | |
print("{:<15}{:>3}".format(term, count)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment