lr1 -> task_1 -> e3-e8
This commit is contained in:
24
lr10/task_1/e5.java
Normal file
24
lr10/task_1/e5.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package lr10.task_1;
|
||||
|
||||
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 e5 {
|
||||
public static void main(String[] args) {
|
||||
String url = "https://itlearn.ru/first-steps";
|
||||
try {
|
||||
Document doc = Jsoup.connect(url).get();
|
||||
|
||||
Elements links = doc.select("a[href]");
|
||||
|
||||
for (Element link : links) {
|
||||
System.out.println(link.attr("abs:href"));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user