complete task INDX-0002. parse one site from list
This commit is contained in:
parent
8425b6a500
commit
a60533aa1a
@ -11,7 +11,6 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
@ -21,7 +20,6 @@ import java.util.regex.Pattern;
|
||||
public class IndexingServiceImpl implements IndexingService {
|
||||
private boolean indexingIsRunning = false;
|
||||
private final SitesList sitesList;
|
||||
private final Random random = new Random();
|
||||
|
||||
@Override
|
||||
public void startIndexing() {
|
||||
@ -68,8 +66,8 @@ public class IndexingServiceImpl implements IndexingService {
|
||||
return; // Если URL уже был обработан, выходим
|
||||
}
|
||||
|
||||
// Задержка для соблюдения правил robots.txt
|
||||
Thread.sleep(50 + random.nextInt(150));
|
||||
// Задержка для защиты от блокировки
|
||||
Thread.sleep((long) (50 + (Math.random() * 150)));
|
||||
System.out.println("Парсим страницу: " + link.uri());
|
||||
|
||||
// Добавляем дочерние ссылки
|
||||
|
Loading…
x
Reference in New Issue
Block a user