summaryrefslogtreecommitdiff
path: root/unbiasedObjects.py
blob: 2233b0cd5a4151c1b908bd5a36163fc7d3b571c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
class Article():
    title=''
    url=''
    img=''
    description=''
    source=''

    def __init__(self, title, url, img, description, source):
        self.title=title
        self.url=url
        self.img=img
        self.description=description
        self.source=source

    def __str__(self):
        return '-----------\n'+self.title+'\n'+self.source+'\n'+self.description+'\n'+self.url+'\n'+self.img+'\n'+'-----------'


class NewsSource2():
    name=''
    url=''
    h1Arr=[]
    h2Arr=[]
    h3Arr=[]
    def __init__(self, name, url, h1Arr, h2Arr, h3Arr):
        self.name=name
        self.url=url
        self.h1Arr=h1Arr
        self.h2Arr=h2Arr
        self.h3Arr=h3Arr
        

        
class NewsSource():
    name=''
    url=''
    #multiple start values to step through file. end value default to '"'
    h1SectionDividerStart=None
    h1SectionDividerEnd=None
    h1DelStart=[]
    h1DelEnd='"'
    h2SectionDividerStart=None
    h2SectionDividerEnd=None
    h2DelStart=[]
    h2DelEnd='"'
    h3SectionDividerStart=None
    h3SectionDividerEnd=None
    h3DelStart=[]
    h3DelEnd='"'
    #arrays of Article object types
    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,
                 stubURL=None):
        self.name=name
        self.url=url
        self.h1DelStart=h1DelStart
        self.h2DelStart=h2DelStart
        self.h3DelStart=h3DelStart
        self.h1SectionDividerStart=h1SectionDividerStart
        self.h2SectionDividerStart=h2SectionDividerStart
        self.h3SectionDividerStart=h3SectionDividerStart
        self.h1SectionDividerEnd=h1SectionDividerEnd
        self.h2SectionDividerEnd=h2SectionDividerEnd
        self.h3SectionDividerEnd=h3SectionDividerEnd
        self.h1Arr=[]
        self.h2Arr=[]
        self.h3Arr=[]
        self.stubURL=stubURL

    def addArticle(self, article, level):
        if level==1:
            self.h1Arr.append(article)
        elif level==2:
            self.h2Arr.append(article)
        elif level==3:
            self.h3Arr.append(article)
        else:
            print("Error: invalid level in NewsSource.addArtlce: ", level)