From 53e8b692f6374b72238df797bf14e94f0567b331 Mon Sep 17 00:00:00 2001 From: sstvinc2 Date: Thu, 16 Feb 2017 16:02:24 -0600 Subject: Added The Guardian to sources --- unbiasedFunctions.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'unbiasedFunctions.py') diff --git a/unbiasedFunctions.py b/unbiasedFunctions.py index 57c8c6a..de27228 100644 --- a/unbiasedFunctions.py +++ b/unbiasedFunctions.py @@ -22,11 +22,18 @@ def buildArticle(url, sourceName):#, titleDelStart, titleDelEnd, imgDelStart, im f.close() try: - #because the quote separator could be ' or ", trim to just before it then lop it off - img=content.split('og:image" content=')[1][1:].split('>')[0] - if img[-1]=='/': - img=img[:-1].strip() - img=img[:-1] + if sourceName=='The Guardian': + #The Guardian puts an identifying banner on their og:images + #grab the main image from the page instead + img=content.split('')[0] + if img[-1]=='/': + #because the quote separator could be ' or ", + #trim to just before it then lop it off + img=img[:-1].strip() + img=img[:-1] title=content.split('og:title" content=')[1][1:].split('>')[0] if title[-1]=='/': -- cgit v1.2.3