Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20210331] Jsoup(Java 크롤링), robots.txt #83

Open
JuHyun419 opened this issue Mar 31, 2021 · 0 comments
Open

[20210331] Jsoup(Java 크롤링), robots.txt #83

JuHyun419 opened this issue Mar 31, 2021 · 0 comments
Labels

Comments

@JuHyun419
Copy link
Owner

자바 크롤링 - Jsoup, robots.txt(크롤링 금지 사항)

package inflearn;

import org.jsoup.Connection;
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 InflearnCrawling {

    private static final String URL = "https://www.inflearn.com/courses";

    public static void main(String[] args) {
        try {
            Connection conn = Jsoup.connect(URL);

            Document html = conn.get();

            Elements elements = html.getElementsByClass("course_title");

            for (Element element : elements) {
                System.out.println(element);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

image

  • 제목 class

image

@JuHyun419 JuHyun419 added the Java label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant