diff --git a/RedditCommentsParser.py b/RedditCommentsParser.py index ec899d6..5d810b6 100644 --- a/RedditCommentsParser.py +++ b/RedditCommentsParser.py @@ -17,7 +17,11 @@ class RedditComments: return username + " " + date def getText(self, commentObj): - return commentObj.find("p").text + p = commentObj.find("p") + if p is not None: + return p.text + else: + return "" def getComments(self): for co in self.commentObjects: diff --git a/Utils.py b/Utils.py index db3b622..a8309c9 100644 --- a/Utils.py +++ b/Utils.py @@ -16,7 +16,7 @@ def checkReddit(link): def checkRedditComments(links): for link in links: - if re.search("^https://www.reddit.com/[a-z1-9/]+/comments", link) is not None: + if re.search("^https://www.reddit.com/[a-zA-Z1-9/]+/comments", link) is not None: return link return False