| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | coin.setPageSize(10); |
| | | coinService.coinInList(coin); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String s = execCurl("https://api2.chiaexplorer.com/blockchainSummary"); |
| | | System.out.println(s); |
| | | } |
| | | |
| | | private static String execCurl(String url) { |
| | | String[] cmds = {"curl", url |
| | | , "-H", "sec-ch-ua: \" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\"" |
| | | ,"-H", "Accept: application/json, text/plain, */*" |
| | | ,"-H", "Referer: https://www.chiaexplorer.com/" |
| | | ,"-H", "sec-ch-ua-mobile: ?0" |
| | | ,"-H", "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" |
| | | ," --compressed"}; |
| | | |
| | | ProcessBuilder process = new ProcessBuilder(cmds); |
| | | Process p; |
| | | try { |
| | | p = process.start(); |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); |
| | | StringBuilder builder = new StringBuilder(); |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | builder.append(line); |
| | | builder.append(System.getProperty("line.separator")); |
| | | } |
| | | return builder.toString(); |
| | | |
| | | } catch (IOException e) { |
| | | System.out.print("error"); |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |