Blog Aggregator

In this blog i will be writing about how to make a blog aggregator.

A blog aggregator is a web application which aggregates syndicated web content such as online newspapers, blogs, podcasts, and video blogs in one location for easy viewing.The most important ingredient in making a blog aggregator is to import the rss feed. we can use Django to develop a full fledged blog aggregator in python. The steps to make a blog aggregator are mentioned bellow:



First we need to create a virtual environment in which we must create a django project named rssfeed(these names are just for reference). Inside this project we must create an app named blogaggr. We must add the blogaggr name in the installed apps inside file of the project rssfeed.Inside the file of the project we need to add url(r’^feed/’, include(‘blogaggr.urls’)),  which will let the project access the urls inside the blogaggr using the url ‘feed’.

Inside the app:

Inside we need to type:

class link(models.Model):
     url = models.CharField(max_length=250)

     def __str__(self):
          return self.url

Here we are creating a class named link in which we are defining url as the model to stored data after parsing the data from the feed as you will see below. We are then returning itself.

Inside first we import views from the same folder.Then we need to type:

urlpatterns = [
url(r’^blogaggr’, views.feed, name = ‘feed’),
url(r’^search’,, name = ‘search’),


Here we are defining 2 urls, ‘blogaggr’ and ‘search’ which are used to import the feed and search in the file respectively. Then we are naming them as feed and search.


We need to create a templates folder in the app and inside it a folder named blogaggr(i.e. the name of the app) and inside it create a html file named home.html


Enter the RSS feed link to be searched:




First inside the head of the file we give links to bootstrap which will help our web page to look beautiful. In the body we need to add an action in form to send the data to the file specified(i.e, feed/search). Then we add a textbox with the name ‘q’ which is specified as to ease the use of the data in it. Then we add a submit button.

Screenshot from 2018-07-05 22-47-12

In the file of the app first we import forms, render, models, HttpResponse, re, feedparser. Then we define feed which will return all the data that has been saved in the html file. Next we define search in which we get ‘q’ present in the home.html file’s textbox then we define d as the parsed data from the rssfeed of q. And then we define s as the feed’s title and description. Then for every post inside ‘d'(i.e,the parsed data) we define s as itself plus the post title and sm as the post summary and the next line is the regular expression. Then we define s as itself plus the data stored inside sm. Then for every post in ‘d’ we add its post link to the data we gathered. Next we save it all in the url and return a HttpResponse of s. If the rss feed is not found or if nothing is inputed we show an error as a HttpResponse.

Thank you.

Continue reading “Blog Aggregator”