Explorar el Código

Fido-URLFetchFinished

Roy hace 6 años
padre
commit
a1603d2710
Se han modificado 4 ficheros con 35 adiciones y 1 borrados
  1. 5
    0
      .idea/ZCW-Fido-URLFetch.iml
  2. 14
    0
      pom.xml
  3. 16
    1
      src/main/java/Main.java
  4. BIN
      target/classes/Main.class

+ 5
- 0
.idea/ZCW-Fido-URLFetch.iml Ver fichero

@@ -11,5 +11,10 @@
11 11
     </content>
12 12
     <orderEntry type="inheritedJdk" />
13 13
     <orderEntry type="sourceFolder" forTests="false" />
14
+    <orderEntry type="library" name="Maven: org.jsoup:jsoup:1.11.3" level="project" />
15
+    <orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.2.0" level="project" />
16
+    <orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.0.0" level="project" />
17
+    <orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.1.0" level="project" />
18
+    <orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.2.0" level="project" />
14 19
   </component>
15 20
 </module>

+ 14
- 0
pom.xml Ver fichero

@@ -19,5 +19,19 @@
19 19
             </plugin>
20 20
         </plugins>
21 21
     </build>
22
+    <dependencies>
23
+        <dependency>
24
+            <!-- jsoup HTML parser library @ https://jsoup.org/ -->
25
+            <groupId>org.jsoup</groupId>
26
+            <artifactId>jsoup</artifactId>
27
+            <version>1.11.3</version>
28
+        </dependency>
29
+        <dependency>
30
+            <groupId>org.junit.jupiter</groupId>
31
+            <artifactId>junit-jupiter-api</artifactId>
32
+            <version>5.2.0</version>
33
+            </dependency>
34
+    </dependencies>
35
+
22 36
     
23 37
 </project>

+ 16
- 1
src/main/java/Main.java Ver fichero

@@ -1,7 +1,22 @@
1
+import org.jsoup.Connection;
2
+import org.jsoup.Jsoup;
3
+import org.jsoup.nodes.Document;
4
+
5
+
6
+import java.io.IOException;
7
+import java.util.Scanner;
8
+
1 9
 public class Main {
2
-    public static void main(String[] args) {
10
+    public static void main(String[] args) throws IOException {
3 11
         //ask for a url
4 12
         // fetch the url
5 13
         // print the url
14
+        Scanner in = new Scanner(System.in);
15
+        System.out.println("Enter a url");
16
+
17
+        String url = in.nextLine();
18
+
19
+        Document doc = Jsoup.connect(url).get();
20
+        System.out.println(doc);
6 21
     }
7 22
 }

BIN
target/classes/Main.class Ver fichero