From ef0dc339f42c6befd07f0d626c1eaed8ad7ee057 Mon Sep 17 00:00:00 2001 From: ssstvinc2 Date: Fri, 24 Mar 2017 19:05:54 -0400 Subject: Added ABC News, some parser fixes as well --- unbiasedFunctions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'unbiasedFunctions.py') diff --git a/unbiasedFunctions.py b/unbiasedFunctions.py index fca2f2d..1a80d7a 100644 --- a/unbiasedFunctions.py +++ b/unbiasedFunctions.py @@ -41,7 +41,10 @@ def buildArticle(url, sourceName, encoding=None):#, titleDelStart, titleDelEnd, img=img.split('src="', 1)[1].split('"')[0] else: - img=content.split('og:image" content=')[1][1:].split('>')[0] + if 'og:image' in content: + img=content.split('og:image" content=')[1][1:].split('>')[0] + elif sourceName=='ABC News': + img='https://c1.staticflickr.com/7/6042/6276688407_12900948a2_b.jpgX' if img[-1]=='/': #because the quote separator could be ' or ", #trim to just before it then lop it off -- cgit v1.2.3