-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.java
66 lines (62 loc) · 1.8 KB
/
help.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package picnic;
/**
*
* @author Rew1L
*/
public class help
{
/**
*
* @param start
* @param finish
* @return
*/
public static String getLineOfItems(int start, int finish)
{
String str = "";
for(int i = start; i<finish; i++)
{
str = str+Picnic.whatNeedToFind[i]+" ";
}
return str;
}
/**
*
* @param line what we want to check
* @param page depth of scaning
*/
public static void checkLink(String line, int page)
{
if(line.contains("<a href=\"") && !line.contains("video") && line.length()<150)
{
if(line.contains(Picnic.urls.get(0)))
{
line = line.replaceAll(".*<a href=\"", ""); //select only link
line = line.replaceAll("\".*","");
if((!Picnic.urls.contains(line)) && (page < 3)) //depth of scaning
{
Picnic.urls.add(line); //adding new link
Picnic.numUrls++;
Thread newThread = new Thread(new findOnPage(page)); //new thread for finding on other page
if(page==1)
newThread.setPriority(Thread.NORM_PRIORITY);
else
newThread.setPriority(Thread.MIN_PRIORITY);
try
{
newThread.start();
}
catch(Exception ex)
{
System.out.println("Can't create new thread.");
}
}
}
}
}
}