summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmain.py10
-rw-r--r--unbiasedFunctions.py10
-rw-r--r--unbiasedObjects.py8
3 files changed, 24 insertions, 4 deletions
diff --git a/main.py b/main.py
index ada2e37..3d7b0ee 100755
--- a/main.py
+++ b/main.py
@@ -15,7 +15,17 @@ def run():
sourceList=[]
+ sourceList.append(NewsSource('BBC US',
+ 'http://www.bbc.com/news/world/us_and_canada',
+ ['buzzard-item', '<a href="'],
+ ['top_stories#', '<a href="'],
+ [],
+ None, None,
+ '<div class="pigeon">','<div id=',
+ None, None,
+ 'http://www.bbc.com'))
+
sourceList.append(NewsSource('NBC News',
'http://nbcnews.com',
['top-stories-section', 'panel_hero', '<a href="'],
diff --git a/unbiasedFunctions.py b/unbiasedFunctions.py
index b770b60..2cdae81 100644
--- a/unbiasedFunctions.py
+++ b/unbiasedFunctions.py
@@ -88,7 +88,10 @@ def extractURLs(content, source):
h1=h1.split(delim)[1]
h1=h1.split(source.h1DelEnd)[0]
if '.com' not in h1:
- h1=source.url+h1
+ if source.stubURL!=None:
+ h1=source.stubURL+h1
+ else:
+ h1=source.url+h1
h1s.append(h1)
h2=content
@@ -105,7 +108,10 @@ def extractURLs(content, source):
x=x.split(source.h2DelEnd)[0]
h2=h2.split(source.h2DelEnd, 1)[1]
if '.com' not in x:
- x=source.url+x
+ if source.stubURL!=None:
+ x=source.stubURL+x
+ else:
+ x=source.url+x
h2s.append(x)
diff --git a/unbiasedObjects.py b/unbiasedObjects.py
index 56530c5..b1f6ec5 100644
--- a/unbiasedObjects.py
+++ b/unbiasedObjects.py
@@ -36,12 +36,15 @@ class NewsSource():
h1Arr=None
h2Arr=None
h3Arr=None
-
+ #url to attach to stub links
+ stubURL=''
+
def __init__(self, name, url,
h1DelStart, h2DelStart, h3DelStart,
h1SectionDividerStart=None, h1SectionDividerEnd=None,
h2SectionDividerStart=None, h2SectionDividerEnd=None,
- h3SectionDividerStart=None, h3SectionDividerEnd=None):
+ h3SectionDividerStart=None, h3SectionDividerEnd=None,
+ stubURL=None):
self.name=name
self.url=url
self.h1DelStart=h1DelStart
@@ -56,6 +59,7 @@ class NewsSource():
self.h1Arr=[]
self.h2Arr=[]
self.h3Arr=[]
+ self.stubURL=stubURL
def addArticle(self, article, level):
if level==1: