-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
100 lines (85 loc) · 1.97 KB
/
index.html
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
<html>
<head>
<title>TradingView data scrapper</title>
<style>
body {
background-color: cadetblue;
font-family: 'Open Sans', sans-serif;
}
body,
input,
button {
font-size: 2rem;
}
form {
display: grid;
grid-template-columns: 150px 1fr;
row-gap: 20px;
align-items: center;
max-width: 900px;
margin: 200px auto 0;
}
label {
font-weight: bold;
}
input {
padding: 1rem 1.5rem;
border: none;
}
input,
button {
border-radius: 1rem;
outline: none;
}
button {
background-color: teal;
color: white;
border: none;
padding: 1rem;
cursor: pointer;
}
button:active {
background-color: darkslategrey;
}
</style>
<script>
function handleSubmit(event) {
event.preventDefault();
const formatDate = value => {
const date = new Date(value);
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")} ${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
}
const data = {
url: document.querySelector('[name=url]').value,
from: formatDate(document.querySelector('[name=from]').value),
to: formatDate(document.querySelector('[name=to]').value),
}
console.log(data)
fetch("http://localhost:43691/scrap", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
});
}
</script>
</head>
<body>
<form onSubmit="handleSubmit(event)">
<label>URL:</label>
<input type="url" name="url"
placeholder="https://www.tradingview.com/chart/EURJPY/2mipoaBZ-Head-And-Shoulders-And-123-pattern/"
autocomplete="off" required />
<label>From:</label>
<input type="datetime-local" name="from" required />
<label>To:</label>
<input type="datetime-local" name="to" required />
<button type="submit">Scrap it!</button>
<button type="reset">Reset</button>
</form>
</body>
</html>