Skip to content
This repository was archived by the owner on May 7, 2020. It is now read-only.

Commit 7797894

Browse files
author
Avi Shah
committed
Minor bug fixes
1 parent d5ed7a8 commit 7797894

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

application.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,7 @@ def index():
2929
websiteLean = 'other'
3030

3131
title = ''
32-
if "." not in websiteAddress:
33-
title = 'none'
34-
elif websiteAddress[0:7] == 'http://' or websiteAddress[0:8] == 'https://':
35-
page = requests.get(websiteAddress)
36-
tree = html.fromstring(page.content)
37-
title = str(tree.xpath('//title/text()'))
38-
else:
39-
websiteAddress = 'http://' + websiteAddress
40-
page = requests.get(websiteAddress)
41-
title = str(tree.xpath('//title/text()'))
42-
43-
title = title.replace("['", '')
44-
title = title.replace('["', '')
45-
title = title.replace("']", '')
46-
title = title.replace('"]', '')
47-
title = title.replace("',", '')
48-
title = title.replace("'", '')
49-
title = title.replace(' ', '%20')
50-
title = title.replace('|', '%20')
51-
32+
5233
return render_template('evaluation.html', topic=topic, websiteLean=websiteLean, title=title, websiteAddress=websiteAddress)
5334

5435
app.run(debug=False, host='0.0.0.0')

templates/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ <h1 class="display-4">News at <span style="color: #00b33c"><strong id="jumbotron
3939
<p>How it Works: Polibugs will find the political bias of the news site you provide and balance your news diet by presenting information on the topic or today's news from sources with differing leaning.</p>
4040
</div>
4141
<div class="container">
42-
<form>
42+
<form action="{{url_for('index')}}" method="POST">
4343
<div class="form-group row">
44-
<label for="topic" class="col-sm-2 col-form-label">Article Topic</label>
44+
<label for="topic" class="col-sm-2 col-form-label" style="color:#ffffff;">Article Topic</label>
4545
<div class="col-sm-10">
46-
<input type="text" class="form-control" id="topic" name="topic" placeholder="Enter news article topic">
46+
<input class="form-control" name="topic" placeholder="Enter news article topic">
4747
<small id="formHelp" class="form-text text-muted">You may leave the topic value blank to get today's top news.</small>
4848
</div>
4949
</div>
5050
<div class="form-group row">
51-
<label for="URL" class="col-sm-2 col-form-label">Article or News Site URL</label>
51+
<label for="URL" class="col-sm-2 col-form-label" style="color:#ffffff;">Article or News Site URL</label>
5252
<div class="col-sm-10">
53-
<input type="text" class="form-control" id="article" name="websiteAddress" placeholder="Enter news article URL">
53+
<input class="form-control" name="websiteAddress" placeholder="Enter news article URL">
5454
<small id="formHelp" class="form-text text-muted">You may leave the article URL value blank to get news from a balanced variety of sources.</small>
5555
</div>
5656
</div>

0 commit comments

Comments
 (0)