-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.java
262 lines (215 loc) · 5.96 KB
/
app.java
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
import java.awt.EventQueue;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.ActionEvent;
import javax.swing.JRadioButton;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
public class App {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
App window = new App();
window.frame.setTitle("Duunitori Automatic Job Application Sender");
window.frame.setVisible(true); //Makes the window actually visible
} catch (Exception e) { //Error tracker
e.printStackTrace();
}
}
});
}
public App() throws IOException {
initialize(); //Launches the window
}
private void initialize() throws IOException { //--The actual window--//
frame = new JFrame();
frame.setBounds(500, 300, 1000, 700); //Sets the size and spawn position of the window
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Closes the application when pressing X
frame.setResizable(false); //Disables resizing
JPanel panel = new JPanel();
frame.getContentPane().add(panel, BorderLayout.CENTER);
panel.setLayout(null);
JRadioButton rb1 = new JRadioButton("New radio button");
rb1.setBounds(34, 42, 109, 23);
panel.add(rb1);
JRadioButton rb2 = new JRadioButton("New radio button");
rb2.setBounds(34, 63, 109, 23);
panel.add(rb2);
JButton btnHallitse = new JButton("Hallitse");
btnHallitse.setBounds(21, 104, 142, 23);
panel.add(btnHallitse);
ButtonGroup group = new ButtonGroup();
group.add(rb1);
group.add(rb2);
FindJobs();
}
private void FindJobs() throws IOException {
int T = 0;
int TP = 1; //TotalPages
int Jobs = 0; //Found jobs
Document Source = Jsoup.connect("https://duunitori.fi/tyopaikat/?haku=tieto-+ja+tietoliikennetekniikka&alue=Pirkanmaa&sivu=1&order_by=search_rank").get(); //Gets the page
int TotalPages = Integer.parseInt(Source.select("div.pagination__pages").text().replace("Sivu 1 / ", "")); //Gets the total amount of pages
while(TP <= TotalPages) {
System.out.println("Page " + TP); //Current page
while(T < 19) { //20 results per page
String Job = Source.select("h3.job-box__title").eq(T).text(); //Selects the nth job
String JobPage = "https://duunitori.fi" + Source.select("a.job-box__hover").eq(T).attr("href"); //Selects the link of the nth job
if(CheckSkills(JobPage) > 0) //If you have at least one of the preferred skills, print
{
System.out.println(Job);
System.out.println("Preferred Skills: " + CheckSkills(JobPage) + "/" + CheckAllKnownSkills(JobPage));
System.out.println(JobPage);
System.out.println();
Jobs+=1; //Increases found jobs by 1
}
T+=1;
}
Source = Jsoup.connect("https://duunitori.fi/tyopaikat/?haku=tieto-+ja+tietoliikennetekniikka&alue=Pirkanmaa&sivu=" + TP + "&order_by=search_rank").get();
TP = TP + 1;
T = 0; //Resets the T loop
}
System.out.println("Jobs found: " + Jobs);
}
private int CheckSkills(String JobPage) throws IOException {
String[] Skills = { //Your skills
"Office",
"Photoshop",
"HTML",
"CSS",
"PHP",
"SQL",
"MySQL",
"Java",
"JavaScript",
"jQuery",
"C#",
"XML",
"XSLT",
"LUA",
"Android",
};
int T = 0;
int RequiredSkills = 0;
Document Source = Jsoup.connect(JobPage).get(); //Gets the page
String Description = Source.select("div.description-box").first().text(); //Gets the description box
//System.out.println(Description);
while(T < Skills.length) {
if(Description.contains(Skills[T])) { //If the description contains a skill you have, increase number
RequiredSkills += 1;
}
T+=1;
}
return RequiredSkills;
}
private int CheckAllKnownSkills(String JobPage) throws IOException {
String[] AllKnownSkills = { //All known skills, including your missing skills
"Office",
"Photoshop",
"HTML",
"CSS",
"PHP",
"SQL",
"MySQL",
"Java",
"JavaScript",
"jQuery",
"C#",
"XML",
"XSLT",
"LUA",
"Android",
"C++",
"Python",
"Pandas",
"Scipy",
"scikit",
"Keras",
"Tensorflow",
"Scala",
"Spark",
"Hadoop",
"Azure",
"IBM Watson",
"Robot Framework",
"Qt",
"QML",
"OpenShift",
"AWS",
"Linux",
"QNX",
"Active Directory",
"Windows Server",
"Microservice",
"REST",
"GraphQL",
"JSON",
"GIT",
"Docker",
"Ansible",
"Jenkins",
"SonarQube",
"DevOps",
"Scrum",
"Kanban",
"CI",
"Angular",
"Node.js",
"Vue",
"Spring",
"ES6",
"React",
"ReactJS",
"SASS",
".NET",
"X++",
"WordPress",
"Magento",
"Less",
"MariaDB",
"MongoDB",
"MSSQL",
"PostgreSQL",
"NoSQL",
"SQL Server",
"IIS",
"CI",
"CD",
"LESS",
"VBScript",
"Powershell",
"LAMP",
"JPA",
"JSF",
"Vert.x",
"Schemat",
"xxlt",
"xquery",
"xpath",
};
int T = 0;
int RequiredSkills = 0;
Document Source = Jsoup.connect(JobPage).get(); //Gets the page
String Description = Source.select("div.description-box").first().text(); //Gets the description box
//System.out.println(Description);
while(T < AllKnownSkills.length) {
if(Description.contains(AllKnownSkills[T])) { //If the description contains a skill you have, print skill
RequiredSkills += 1;
}
T+=1;
}
return RequiredSkills;
}
}