-
Notifications
You must be signed in to change notification settings - Fork 0
/
middle_page.py
133 lines (126 loc) · 5.57 KB
/
middle_page.py
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#! C:\Users\Public\Anaconda3\python.exe
#-*- coding:utf-8 -*-
print("content-type:text/html; charset=utf-8\n\n")
import sys
import codecs
import os
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
#import os
#sys.path.insert(0, "C:/Users/Public/Anaconda3/Lib/site-packages")
#sys.path.insert(0, "C:\\Users\\Public\\Anaconda3\\Lib\\site-packages")
from pysource import news as ns
import cgi
import cgitb
import MySQLdb
import test2
cgitb.enable()
form = cgi.FieldStorage()
url = form.getvalue('url')
st1 = form.getvalue('standard1')
st2 = form.getvalue('standard2')
st3 = form.getvalue('standard3')
st4 = form.getvalue('standard4')
k = form.getvalue('ldoption')
#connection = MySQLdb.connect(user='root', password='qwe123', db='ethics', charset='utf8')
#cursor = connection.cursor()
#errorstr = "Not proper news url"
def main_page():
html = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" />
<!-- Google web font "Open Sans" -->
<link rel="stylesheet" href="css/all.min.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/templatemo-style.css" />
<title>Demo page 2</title>
</head>
<!--
Sided Template
https://templatemo.com/tm-527-sided
-->
<body>
<form method='post'>
<div class="columns-bg2">
<!-- Logo & Intro -->
<section id="logo" class="tm-section-logo">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6 offset-sm-3 col-md-6 offset-md-0">
<div class="tm-site-name-container">
<div class="tm-site-name-container-inner">
<h2 class="text-uppercase tm-text-primary tm-site-name">
MAIN PAGE
</h2>
<p class="tm-text-primary tm-site-description2">
Set your article : Naver news link
</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 offset-sm-3 col-md-12 offset-md-1 div-url">
<input type='text' name='url' placeholder=' Enter URL' class="input-url">
</div>
</section>
<section id="logo" class="tm-section-logo2">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6 offset-sm-3 col-md-6 offset-md-0">
<p class="tm-text-primary middle-index">
Set your standards
</p>
</div>
</div>
</div>
<div class="col-sm-6 offset-sm-3 col-md-12 offset-md-1 div-url">
<div> Reply </div> <input type='range' name='standard1' class="input-stand" min="1" max="10" value="1" oninput="document.getElementById('value1').innerHTML=this.value;">
<span id="value1" class="stand-result"></span>
</div>
<div class="col-sm-6 offset-sm-3 col-md-12 offset-md-1 div-url">
<div> Like / Dislike </div> <input type='range' name='standard2' class="input-stand" min="1" max="10" value="1" oninput="document.getElementById('value2').innerHTML=this.value;">
<span id="value2" class="stand-result"></span>
<div> Additional option: </div>
<div style="padding-left: 20px;">
<input type="radio" id="huey" name="ldoption" value="1" checked>
<label for="one"> LIKE + DISLIKE</label>
</div>
<div style="padding-left: 20px;">
<input type="radio" id="dewey" name="ldoption" value="0">
<label for="two"> ONLY LIKE </label>
</div>
<div style="padding-left: 20px;">
<input type="radio" id="louie" name="ldoption" value="-1">
<label for="three"> LIKE - DISLIKE </label>
</div>
</div>
<div class="col-sm-6 offset-sm-3 col-md-12 offset-md-1 div-url">
<div> Keyword </div> <input type='range' name='standard3' class="input-stand" min="1" max="10" value="1" oninput="document.getElementById('value3').innerHTML=this.value;">
<span id="value3" class="stand-result"></span>
</div>
<div class="col-sm-6 offset-sm-3 col-md-12 offset-md-1 div-url">
<div> Similarity </div> <input type='range' name='standard4' class="input-stand" min="1" max="10" value="1" oninput="document.getElementById('value4').innerHTML=this.value;">
<span id="value4" class="stand-result"></span>
</div>
</section>
<div style="text-align:center; padding-top:30px; padding-bottom:100px;">
<input type='submit' value='ANALYSIS'/>
</div>
</div>
</form>
<!-- /.columns-bg -->
</body>
</html>
"""
print(html)
try:
test_u = url
result = ns.get_news(test_u)
test2.footer(url, st1, st2, st3, st4, k)
except:
main_page()