Pick up news from a specific website

Asked

Viewed 500 times

10

I am currently looking for a solution to implement a module in my App to pick up news from a specific website and show on the screen of the news module.

Someone can show me a way?

1 answer

11

The name of this type of practice is scraping page, a variation of screen scraping. According to the Wikipedia page,

[..] a technique in which a computer program extracts data from video output from another program. [...] The key element that distinguishes the screen scraping from the Parsing it is customary that the exit that is being captured was intended to be viewed by a user human , instead of serving as input for another program [...] There are a number of synonyms, including: web scraping, page scraping, web page wrapping and HTML scraping (specific for webpages).

The example below, for Android, demonstrates this behavior:

public static void main(String... args) throws Exception {
    Document document = Jsoup.connect("/questions/88690").get();
    String question = document.select("#question .post-text p").first().text();
    System.out.println(question);
}

The end result is the extraction of the title of your question, 'Get news from a specific website!'.

Sources:
Screen scraping (Wikipedia)
What is the Fastest way to Scrape HTML webpage in Android?

  • Uhnn. I understand. I will try to implement and return to share the final result! I am grateful for the help, friend!

  • @Rodolfoabrantes It’s a pleasure to help, and I hope it works!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.