New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

com.github.qlone:retrofit-crawler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.qlone:retrofit-crawler

help you get a html like json,thanks retrofit and Jsoup

  • 1.1.3
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

retrofit-crawer

help you get a html like json


Maven

<dependency>
  <groupId>com.github.qlone</groupId>
  <artifactId>retrofit-crawler</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle

implementation 'com.github.qlone:retrofit-crawler:1.0.0'

Make a interface

First, you can create a interface like retrofit and add some rules like json.

public interface Google {

    @POST("/topstories")
    Call<TopStoyResp> topstories();
    
}

public class TopStoyResp {

    @Select("div[jscontroller = d0DtYd]")
    private List<News> news;

    public static class News{

        @Text("article h3 a")
        private String titile;

        @Attr(value = "div[jsname = gKDw6b] a",attr = "href")
        private String url;
    }
}

Crawling web data

Create a retrofitCrawler in order to init our interface

RetrofitCrawler retrofitCrawler = new RetrofitCrawler.Builder()
                .baseUrl("https://news.google.com")
                .build();
Google google = retrofitCrawler.create(Google.class);

Now, you can use google.class to get some data. You can execute sync or async.

 Call<TopStoyResp> topstories = google.topstories();
 Response<TopStoyResp> execute = topstories.execute();
 TopStoyResp resp = execute.body();

Issuses

Report issues to hewinana@gmail.com or github issues

FAQs

Package last updated on 22 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc