Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is a simple bot which fetches RSS feeds and posts them to an IRC channel.

- python3
- pip3
- virtualenv (`pip3 install virtualenv`)
- venv (`Available by default in Python 3.3+`)

# Features

Expand Down Expand Up @@ -40,7 +40,7 @@ Help:
Clone this repository and change into the directory. Create a new virtualenv and activate it:

```
virtualenv -p python3 venv
python3 -m venv venv
source venv/bin/activate
```

Expand Down
8 changes: 4 additions & 4 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys
import feedparser
import datetime
import dateutil.parser
import requests
from colour import Colours
from db import FeedDB
Expand Down Expand Up @@ -203,10 +202,11 @@ def post_news(self, feed_name, title, url, date):

def shorten(self, url):
try: # Trying to shorten URL
sresponse = requests.get('https://v.gd/create.php?format=json&url=' + url)
surl = sresponse.json()['shorturl']
api = 'https://tinyurl.com/api-create.php?url='
sresponse = requests.get(api + url)
surl = sresponse.text
except Exception as err:
print('A shortening error occurred.')
print('A shortening error occurred:', sresponse.status_code)
surl = url
return surl

Expand Down
9 changes: 4 additions & 5 deletions config.py.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

class Config(object):
lastpubmsg = 0

### SETTINGS ###

def __init__(self):
self.HOST = 'irc.rizon.net'
Expand Down Expand Up @@ -32,6 +31,6 @@ class Config(object):
self.postdelay = 180 # Post delay during conversation in seconds. 0 for off.
self.feedorderdesc = False
self.update_before_connecting = True # Update all feeds before connecting to the IRC server
self.filterkeywords = () # Lower-case keywords list to filter in title news. Use
# ('one','two','three') to activate or () for deactivate.
self.filterkeywords = [] # Lower-case keywords list to filter in news title. Use
# ['one','two','three'] to activate or [] for deactivate.

1 change: 0 additions & 1 deletion feedupdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def __fetch_feed(self, feed_info, callback, forever):
for newsitem in news.entries[::-1]:
newstitle = newsitem.title
newsurl = newsitem.link
# print datetime.datetime.now(), newsurl

# Try to get the published or updated date. Otherwise set it to 'no date'
try:
Expand Down