最近有个定时任务的需求, 要把中国银行官网上的汇率数据定时抓取下来

页面地址

https://srh.bankofchina.com/search/whpj/searchen.jsp

此处有个大坑!!! 当请求页面传入page不存在时, 网站会返回最后一页的数据,下方有做处理

代码实现


import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.HttpClientUtils;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.joda.time.DateTime;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.stereotype.Service;import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;/*** 爬取中国银行汇率** @author zhangbs*/
@Service
public class CrawlingExchangeRateService {public void execute() {List queryList = getExchangeRate("USD", "");System.out.println("长度:" + queryList.size());System.out.println("汇总:" + queryList);}/*** 获取当日传入币别汇率信息** @param sourceCurrency 币别* @param date           日期* @return*/private List getExchangeRate(String sourceCurrency, String date) {/***判断入参lsDate是否为空,若为空则赋值为当前时间**/String lsToday = StringUtils.isEmpty(date) ? new DateTime().toString("yyyy-MM-dd") : date;List list = new ArrayList();for (int page = 1; page <= 10; page++) {/**抓取时间为lsToday,币别为sourceCurrency,页数为page的中国银行网页信息*/String searchEnHtml = getSearchEnHtml(lsToday, sourceCurrency, String.valueOf(page));/**开始解析html中的汇率列表信息**/Map map = assembleObjByHtml(searchEnHtml, sourceCurrency, lsToday);String flag = (String) map.get("flag");String htmlPage = (String) map.get("page");list.add (map.get("list"));/**当flag为1执行成功时,或总页数等于循环查询到的页数时,则不需要再次进行查询**/if ("1".equals(flag) || Integer.parseInt(htmlPage) < page) {break;}}return list;}/*** 获取整个网页的内容** @param lsToday          传入当前时间或空* @param lsSourceCurrency 币种* @param liPage           当前查询页数* @return*/private String getSearchEnHtml(String lsToday, String lsSourceCurrency, String liPage) {StringBuilder url = new StringBuilder("https://srh.bankofchina.com/search/whpj/searchen.jsp?");url.append("erectDate=").append(lsToday);url.append("&nothing=").append(lsToday);url.append("&pjname=").append(lsSourceCurrency);url.append("&page=").append(liPage);System.out.println("拼接好的url:" + url);CloseableHttpClient httpClient = HttpClients.createDefault();CloseableHttpResponse response = null;HttpPost httpPost = new HttpPost(url.toString());httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");httpPost.setHeader("Accept", "Accept: text/plain, */*");httpPost.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3724.8 Safari/537.36");httpPost.addHeader("x-amazon-user-agent", "AmazonJavascriptScratchpad/1.0 (Language=Javascript)");httpPost.addHeader("X-Requested-With", "XMLHttpRequest");String html = "";try {response = httpClient.execute(httpPost);/**判断响应状态为200,进行处理**/if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {HttpEntity httpEntity = response.getEntity();html = EntityUtils.toString(httpEntity, "utf-8");} else {System.out.println(EntityUtils.toString(response.getEntity(), "utf-8"));}} catch (ClientProtocolException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();} finally {HttpClientUtils.closeQuietly(response);HttpClientUtils.closeQuietly(httpClient);}/***返回请求得到的页面**/return html;}/*** 根据取得的网页,解析html中的内容 先不做业务逻辑,全部查询** @param html             要解析的html* @param lsSourceCurrency 币种* @param lsToday          日期* @return*/private Map assembleObjByHtml(String html, String lsSourceCurrency, String lsToday) {/**存储数据**/Map map = new HashMap(5);/**使用Jsoup将html解析为Document对象**/Document document = Jsoup.parse(html);/**获取页面隐藏域中存放的当前页数**/Elements pageItem = document.getElementsByAttributeValue("name", "page");String pageItemValue = "";pageItemValue = pageItem.select("input[name=page]").val();map.put("page", pageItemValue);/**获取页面的整个table信息,这个返回的页面基本上是返回多个table,下方需要细化处理**/Elements tables = document.getElementsByTag("table");/**设置存放汇率信息的table下标为-1(默认不存在)**/int tableIndex = -1;/**从table中循环获取,查找含有Currency Name字段的table**/for (int i = 0; i < tables.size(); i++) {Element element = tables.get(i);String text = element.text();/**找到含有汇率信息的table,给tableIndex赋值,跳出循环**/if (text.indexOf("Currency Name") > -1) {tableIndex = i;break;}}List<TerstEntity> list = new ArrayList();/**如果找到汇率列表信息**/if (tableIndex > -1) {Element table = tables.get(tableIndex);/**遍历该表格内的所有的<tr> <tr/>*/Elements trs = table.select("tr");for (int i = 1; i < trs.size(); ++i) {TerstEntity terstEntity = new TerstEntity();Element tr = trs.get(i);/**将数据放入实体对象中*/Elements tds = tr.select("td");terstEntity.setCurrencyName(tds.get(0).text());terstEntity.setBuyingRate(tds.get(1).text());terstEntity.setCashBuyingRate(tds.get(2).text());terstEntity.setSellingRate(tds.get(3).text());terstEntity.setCashSellingRate(tds.get(4).text());terstEntity.setMiddleRate(tds.get(5).text());terstEntity.setPubTime(tds.get(6).text());list.add(terstEntity);}map.put("list", list);}else{map.put("flag", "1");}return map;}}

实体类

/*** 测试使用*/
public class TerstEntity {private String currencyName;private String buyingRate;private String cashBuyingRate;private String sellingRate;private String cashSellingRate;private String middleRate;private String PubTime;}

依赖

        <dependency><groupId>org.jsoup</groupId><artifactId>jsoup</artifactId><version>1.12.1</version></dependency>

得到的数据

2020-04-16 15:13:58.069  INFO 1224 --- [           main] c.e.a.amazon.AmazonApplicationTests      : Starting AmazonApplicationTests on boston with PID 1224 (started by 11378 in C:\workspace\idie0409)
2020-04-16 15:13:58.070  INFO 1224 --- [           main] c.e.a.amazon.AmazonApplicationTests      : No active profile set, falling back to default profiles: default
2020-04-16 15:13:58.768  INFO 1224 --- [           main] c.e.a.amazon.AmazonApplicationTests      : Started AmazonApplicationTests in 1.468 seconds (JVM running for 4.035)拼接好的url:https://srh.bankofchina.com/search/whpj/searchen.jsp?erectDate=2020-04-16&nothing=2020-04-16&pjname=USD&page=1
拼接好的url:https://srh.bankofchina.com/search/whpj/searchen.jsp?erectDate=2020-04-16&nothing=2020-04-16&pjname=USD&page=2
拼接好的url:https://srh.bankofchina.com/search/whpj/searchen.jsp?erectDate=2020-04-16&nothing=2020-04-16&pjname=USD&page=3
拼接好的url:https://srh.bankofchina.com/search/whpj/searchen.jsp?erectDate=2020-04-16&nothing=2020-04-16&pjname=USD&page=4
拼接好的url:https://srh.bankofchina.com/search/whpj/searchen.jsp?erectDate=2020-04-16&nothing=2020-04-16&pjname=USD&page=5
拼接好的url:https://srh.bankofchina.com/search/whpj/searchen.jsp?erectDate=2020-04-16&nothing=2020-04-16&pjname=USD&page=6
拼接好的url:https://srh.bankofchina.com/search/whpj/searchen.jsp?erectDate=2020-04-16&nothing=2020-04-16&pjname=USD&page=7
长度:7
汇总:[[TerstEntity{currencyName='USD', buyingRate='706.07', cashBuyingRate='700.33', sellingRate='709.06', cashSellingRate='709.06', middleRate='707.14', PubTime='2020.04.16 15:11:46'}, TerstEntity{currencyName='USD', buyingRate='706.02', cashBuyingRate='700.28', sellingRate='709.01', cashSellingRate='709.01', middleRate='707.14', PubTime='2020.04.16 15:08:24'}, TerstEntity{currencyName='USD', buyingRate='706.07', cashBuyingRate='700.33', sellingRate='709.06', cashSellingRate='709.06', middleRate='707.14', PubTime='2020.04.16 15:08:00'}, TerstEntity{currencyName='USD', buyingRate='706.12', cashBuyingRate='700.38', sellingRate='709.11', cashSellingRate='709.11', middleRate='707.14', PubTime='2020.04.16 15:06:41'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 15:04:48'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 15:02:55'}, TerstEntity{currencyName='USD', buyingRate='706.42', cashBuyingRate='700.67', sellingRate='709.41', cashSellingRate='709.41', middleRate='707.14', PubTime='2020.04.16 15:02:09'}, TerstEntity{currencyName='USD', buyingRate='706.37', cashBuyingRate='700.62', sellingRate='709.36', cashSellingRate='709.36', middleRate='707.14', PubTime='2020.04.16 14:51:38'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 14:47:52'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 14:44:39'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 14:39:56'}, TerstEntity{currencyName='USD', buyingRate='706.22', cashBuyingRate='700.47', sellingRate='709.21', cashSellingRate='709.21', middleRate='707.14', PubTime='2020.04.16 14:37:43'}, TerstEntity{currencyName='USD', buyingRate='706.32', cashBuyingRate='700.57', sellingRate='709.31', cashSellingRate='709.31', middleRate='707.14', PubTime='2020.04.16 14:35:15'}, TerstEntity{currencyName='USD', buyingRate='706.42', cashBuyingRate='700.67', sellingRate='709.41', cashSellingRate='709.41', middleRate='707.14', PubTime='2020.04.16 14:31:43'}, TerstEntity{currencyName='USD', buyingRate='706.47', cashBuyingRate='700.72', sellingRate='709.46', cashSellingRate='709.46', middleRate='707.14', PubTime='2020.04.16 14:30:23'}, TerstEntity{currencyName='USD', buyingRate='706.72', cashBuyingRate='700.97', sellingRate='709.71', cashSellingRate='709.71', middleRate='707.14', PubTime='2020.04.16 14:29:28'}, TerstEntity{currencyName='USD', buyingRate='706.77', cashBuyingRate='701.02', sellingRate='709.76', cashSellingRate='709.76', middleRate='707.14', PubTime='2020.04.16 14:26:21'}, TerstEntity{currencyName='USD', buyingRate='706.87', cashBuyingRate='701.12', sellingRate='709.86', cashSellingRate='709.86', middleRate='707.14', PubTime='2020.04.16 14:23:45'}, TerstEntity{currencyName='USD', buyingRate='706.94', cashBuyingRate='701.19', sellingRate='709.93', cashSellingRate='709.93', middleRate='707.14', PubTime='2020.04.16 14:21:44'}, TerstEntity{currencyName='USD', buyingRate='706.84', cashBuyingRate='701.09', sellingRate='709.83', cashSellingRate='709.83', middleRate='707.14', PubTime='2020.04.16 14:19:16'}], [TerstEntity{currencyName='USD', buyingRate='706.77', cashBuyingRate='701.02', sellingRate='709.76', cashSellingRate='709.76', middleRate='707.14', PubTime='2020.04.16 14:16:37'}, TerstEntity{currencyName='USD', buyingRate='706.72', cashBuyingRate='700.97', sellingRate='709.71', cashSellingRate='709.71', middleRate='707.14', PubTime='2020.04.16 14:13:52'}, TerstEntity{currencyName='USD', buyingRate='706.77', cashBuyingRate='701.02', sellingRate='709.76', cashSellingRate='709.76', middleRate='707.14', PubTime='2020.04.16 14:10:47'}, TerstEntity{currencyName='USD', buyingRate='706.82', cashBuyingRate='701.07', sellingRate='709.81', cashSellingRate='709.81', middleRate='707.14', PubTime='2020.04.16 14:08:57'}, TerstEntity{currencyName='USD', buyingRate='706.77', cashBuyingRate='701.02', sellingRate='709.76', cashSellingRate='709.76', middleRate='707.14', PubTime='2020.04.16 14:02:02'}, TerstEntity{currencyName='USD', buyingRate='706.72', cashBuyingRate='700.97', sellingRate='709.71', cashSellingRate='709.71', middleRate='707.14', PubTime='2020.04.16 14:01:17'}, TerstEntity{currencyName='USD', buyingRate='706.66', cashBuyingRate='700.91', sellingRate='709.65', cashSellingRate='709.65', middleRate='707.14', PubTime='2020.04.16 13:59:16'}, TerstEntity{currencyName='USD', buyingRate='706.62', cashBuyingRate='700.87', sellingRate='709.61', cashSellingRate='709.61', middleRate='707.14', PubTime='2020.04.16 13:58:30'}, TerstEntity{currencyName='USD', buyingRate='706.57', cashBuyingRate='700.82', sellingRate='709.56', cashSellingRate='709.56', middleRate='707.14', PubTime='2020.04.16 13:58:06'}, TerstEntity{currencyName='USD', buyingRate='706.52', cashBuyingRate='700.77', sellingRate='709.51', cashSellingRate='709.51', middleRate='707.14', PubTime='2020.04.16 13:50:38'}, TerstEntity{currencyName='USD', buyingRate='706.57', cashBuyingRate='700.82', sellingRate='709.56', cashSellingRate='709.56', middleRate='707.14', PubTime='2020.04.16 13:47:09'}, TerstEntity{currencyName='USD', buyingRate='706.67', cashBuyingRate='700.92', sellingRate='709.66', cashSellingRate='709.66', middleRate='707.14', PubTime='2020.04.16 13:44:44'}, TerstEntity{currencyName='USD', buyingRate='706.62', cashBuyingRate='700.87', sellingRate='709.61', cashSellingRate='709.61', middleRate='707.14', PubTime='2020.04.16 13:40:14'}, TerstEntity{currencyName='USD', buyingRate='706.57', cashBuyingRate='700.82', sellingRate='709.56', cashSellingRate='709.56', middleRate='707.14', PubTime='2020.04.16 13:37:12'}, TerstEntity{currencyName='USD', buyingRate='706.52', cashBuyingRate='700.77', sellingRate='709.51', cashSellingRate='709.51', middleRate='707.14', PubTime='2020.04.16 13:31:00'}, TerstEntity{currencyName='USD', buyingRate='706.62', cashBuyingRate='700.87', sellingRate='709.61', cashSellingRate='709.61', middleRate='707.14', PubTime='2020.04.16 13:14:10'}, TerstEntity{currencyName='USD', buyingRate='706.67', cashBuyingRate='700.92', sellingRate='709.66', cashSellingRate='709.66', middleRate='707.14', PubTime='2020.04.16 12:52:05'}, TerstEntity{currencyName='USD', buyingRate='706.77', cashBuyingRate='701.02', sellingRate='709.76', cashSellingRate='709.76', middleRate='707.14', PubTime='2020.04.16 12:39:29'}, TerstEntity{currencyName='USD', buyingRate='706.82', cashBuyingRate='701.07', sellingRate='709.81', cashSellingRate='709.81', middleRate='707.14', PubTime='2020.04.16 12:15:11'}, TerstEntity{currencyName='USD', buyingRate='706.77', cashBuyingRate='701.02', sellingRate='709.76', cashSellingRate='709.76', middleRate='707.14', PubTime='2020.04.16 12:05:33'}], [TerstEntity{currencyName='USD', buyingRate='706.72', cashBuyingRate='700.97', sellingRate='709.71', cashSellingRate='709.71', middleRate='707.14', PubTime='2020.04.16 12:03:43'}, TerstEntity{currencyName='USD', buyingRate='706.72', cashBuyingRate='700.97', sellingRate='709.71', cashSellingRate='709.71', middleRate='707.14', PubTime='2020.04.16 11:44:14'}, TerstEntity{currencyName='USD', buyingRate='706.62', cashBuyingRate='700.87', sellingRate='709.61', cashSellingRate='709.61', middleRate='707.14', PubTime='2020.04.16 11:38:16'}, TerstEntity{currencyName='USD', buyingRate='706.67', cashBuyingRate='700.92', sellingRate='709.66', cashSellingRate='709.66', middleRate='707.14', PubTime='2020.04.16 11:37:15'}, TerstEntity{currencyName='USD', buyingRate='706.72', cashBuyingRate='700.97', sellingRate='709.71', cashSellingRate='709.71', middleRate='707.14', PubTime='2020.04.16 11:35:09'}, TerstEntity{currencyName='USD', buyingRate='706.77', cashBuyingRate='701.02', sellingRate='709.76', cashSellingRate='709.76', middleRate='707.14', PubTime='2020.04.16 11:32:57'}, TerstEntity{currencyName='USD', buyingRate='706.67', cashBuyingRate='700.92', sellingRate='709.66', cashSellingRate='709.66', middleRate='707.14', PubTime='2020.04.16 11:30:48'}, TerstEntity{currencyName='USD', buyingRate='706.72', cashBuyingRate='700.97', sellingRate='709.71', cashSellingRate='709.71', middleRate='707.14', PubTime='2020.04.16 11:22:02'}, TerstEntity{currencyName='USD', buyingRate='706.62', cashBuyingRate='700.87', sellingRate='709.61', cashSellingRate='709.61', middleRate='707.14', PubTime='2020.04.16 11:19:35'}, TerstEntity{currencyName='USD', buyingRate='706.52', cashBuyingRate='700.77', sellingRate='709.51', cashSellingRate='709.51', middleRate='707.14', PubTime='2020.04.16 11:18:23'}, TerstEntity{currencyName='USD', buyingRate='706.42', cashBuyingRate='700.67', sellingRate='709.41', cashSellingRate='709.41', middleRate='707.14', PubTime='2020.04.16 11:17:59'}, TerstEntity{currencyName='USD', buyingRate='706.32', cashBuyingRate='700.57', sellingRate='709.31', cashSellingRate='709.31', middleRate='707.14', PubTime='2020.04.16 11:17:36'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 11:07:21'}, TerstEntity{currencyName='USD', buyingRate='706.32', cashBuyingRate='700.57', sellingRate='709.31', cashSellingRate='709.31', middleRate='707.14', PubTime='2020.04.16 11:03:27'}, TerstEntity{currencyName='USD', buyingRate='706.22', cashBuyingRate='700.47', sellingRate='709.21', cashSellingRate='709.21', middleRate='707.14', PubTime='2020.04.16 10:57:13'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 10:55:45'}, TerstEntity{currencyName='USD', buyingRate='706.37', cashBuyingRate='700.62', sellingRate='709.36', cashSellingRate='709.36', middleRate='707.14', PubTime='2020.04.16 10:54:07'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 10:48:25'}, TerstEntity{currencyName='USD', buyingRate='706.22', cashBuyingRate='700.47', sellingRate='709.21', cashSellingRate='709.21', middleRate='707.14', PubTime='2020.04.16 10:47:00'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 10:45:25'}], [TerstEntity{currencyName='USD', buyingRate='706.22', cashBuyingRate='700.47', sellingRate='709.21', cashSellingRate='709.21', middleRate='707.14', PubTime='2020.04.16 10:38:37'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 10:34:55'}, TerstEntity{currencyName='USD', buyingRate='706.12', cashBuyingRate='700.38', sellingRate='709.11', cashSellingRate='709.11', middleRate='707.14', PubTime='2020.04.16 10:30:39'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 10:30:00'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 10:30:00'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 10:30:00'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 10:28:31'}, TerstEntity{currencyName='USD', buyingRate='706.12', cashBuyingRate='700.38', sellingRate='709.11', cashSellingRate='709.11', middleRate='707.14', PubTime='2020.04.16 10:27:03'}, TerstEntity{currencyName='USD', buyingRate='706.17', cashBuyingRate='700.43', sellingRate='709.16', cashSellingRate='709.16', middleRate='707.14', PubTime='2020.04.16 10:21:27'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 10:20:06'}, TerstEntity{currencyName='USD', buyingRate='706.37', cashBuyingRate='700.62', sellingRate='709.36', cashSellingRate='709.36', middleRate='707.14', PubTime='2020.04.16 10:12:27'}, TerstEntity{currencyName='USD', buyingRate='706.32', cashBuyingRate='700.57', sellingRate='709.31', cashSellingRate='709.31', middleRate='707.14', PubTime='2020.04.16 10:11:42'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 10:08:47'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 10:08:47'}, TerstEntity{currencyName='USD', buyingRate='706.32', cashBuyingRate='700.57', sellingRate='709.31', cashSellingRate='709.31', middleRate='707.14', PubTime='2020.04.16 10:06:59'}, TerstEntity{currencyName='USD', buyingRate='706.37', cashBuyingRate='700.62', sellingRate='709.36', cashSellingRate='709.36', middleRate='707.14', PubTime='2020.04.16 10:02:25'}, TerstEntity{currencyName='USD', buyingRate='706.37', cashBuyingRate='700.62', sellingRate='709.36', cashSellingRate='709.36', middleRate='707.14', PubTime='2020.04.16 10:02:22'}, TerstEntity{currencyName='USD', buyingRate='706.32', cashBuyingRate='700.57', sellingRate='709.31', cashSellingRate='709.31', middleRate='707.14', PubTime='2020.04.16 09:58:16'}, TerstEntity{currencyName='USD', buyingRate='706.27', cashBuyingRate='700.52', sellingRate='709.26', cashSellingRate='709.26', middleRate='707.14', PubTime='2020.04.16 09:57:21'}, TerstEntity{currencyName='USD', buyingRate='706.22', cashBuyingRate='700.47', sellingRate='709.21', cashSellingRate='709.21', middleRate='707.14', PubTime='2020.04.16 09:53:21'}], [TerstEntity{currencyName='USD', buyingRate='706.02', cashBuyingRate='700.28', sellingRate='709.01', cashSellingRate='709.01', middleRate='707.14', PubTime='2020.04.16 09:51:11'}, TerstEntity{currencyName='USD', buyingRate='705.87', cashBuyingRate='700.13', sellingRate='708.86', cashSellingRate='708.86', middleRate='707.14', PubTime='2020.04.16 09:49:14'}, TerstEntity{currencyName='USD', buyingRate='705.97', cashBuyingRate='700.23', sellingRate='708.96', cashSellingRate='708.96', middleRate='707.14', PubTime='2020.04.16 09:47:18'}, TerstEntity{currencyName='USD', buyingRate='706', cashBuyingRate='700.26', sellingRate='708.99', cashSellingRate='708.99', middleRate='707.14', PubTime='2020.04.16 09:42:40'}, TerstEntity{currencyName='USD', buyingRate='705.97', cashBuyingRate='700.23', sellingRate='708.96', cashSellingRate='708.96', middleRate='707.14', PubTime='2020.04.16 09:42:27'}, TerstEntity{currencyName='USD', buyingRate='705.92', cashBuyingRate='700.18', sellingRate='708.91', cashSellingRate='708.91', middleRate='707.14', PubTime='2020.04.16 09:41:34'}, TerstEntity{currencyName='USD', buyingRate='705.87', cashBuyingRate='700.13', sellingRate='708.86', cashSellingRate='708.86', middleRate='707.14', PubTime='2020.04.16 09:41:13'}, TerstEntity{currencyName='USD', buyingRate='705.82', cashBuyingRate='700.08', sellingRate='708.81', cashSellingRate='708.81', middleRate='707.14', PubTime='2020.04.16 09:40:33'}, TerstEntity{currencyName='USD', buyingRate='705.87', cashBuyingRate='700.13', sellingRate='708.86', cashSellingRate='708.86', middleRate='707.14', PubTime='2020.04.16 09:38:35'}, TerstEntity{currencyName='USD', buyingRate='705.82', cashBuyingRate='700.08', sellingRate='708.81', cashSellingRate='708.81', middleRate='707.14', PubTime='2020.04.16 09:38:18'}, TerstEntity{currencyName='USD', buyingRate='705.77', cashBuyingRate='700.03', sellingRate='708.76', cashSellingRate='708.76', middleRate='707.14', PubTime='2020.04.16 09:37:26'}, TerstEntity{currencyName='USD', buyingRate='705.87', cashBuyingRate='700.13', sellingRate='708.86', cashSellingRate='708.86', middleRate='707.14', PubTime='2020.04.16 09:36:56'}, TerstEntity{currencyName='USD', buyingRate='705.92', cashBuyingRate='700.18', sellingRate='708.91', cashSellingRate='708.91', middleRate='707.14', PubTime='2020.04.16 09:34:00'}, TerstEntity{currencyName='USD', buyingRate='705.87', cashBuyingRate='700.13', sellingRate='708.86', cashSellingRate='708.86', middleRate='707.14', PubTime='2020.04.16 09:33:02'}, TerstEntity{currencyName='USD', buyingRate='705.97', cashBuyingRate='700.23', sellingRate='708.96', cashSellingRate='708.96', middleRate='707.14', PubTime='2020.04.16 09:31:53'}, TerstEntity{currencyName='USD', buyingRate='705.92', cashBuyingRate='700.18', sellingRate='708.91', cashSellingRate='708.91', middleRate='707.14', PubTime='2020.04.16 09:31:24'}, TerstEntity{currencyName='USD', buyingRate='705.97', cashBuyingRate='700.23', sellingRate='708.96', cashSellingRate='708.96', middleRate='707.14', PubTime='2020.04.16 09:23:29'}, TerstEntity{currencyName='USD', buyingRate='705.97', cashBuyingRate='700.23', sellingRate='708.96', cashSellingRate='708.96', middleRate='707.14', PubTime='2020.04.16 09:23:24'}, TerstEntity{currencyName='USD', buyingRate='705.77', cashBuyingRate='700.03', sellingRate='708.76', cashSellingRate='708.76', middleRate='704.02', PubTime='2020.04.16 09:19:58'}, TerstEntity{currencyName='USD', buyingRate='705.97', cashBuyingRate='700.23', sellingRate='708.96', cashSellingRate='708.96', middleRate='704.02', PubTime='2020.04.16 09:20:13'}], [TerstEntity{currencyName='USD', buyingRate='705.92', cashBuyingRate='700.18', sellingRate='708.91', cashSellingRate='708.91', middleRate='704.02', PubTime='2020.04.16 09:20:07'}, TerstEntity{currencyName='USD', buyingRate='705.87', cashBuyingRate='700.13', sellingRate='708.86', cashSellingRate='708.86', middleRate='704.02', PubTime='2020.04.16 09:20:02'}, TerstEntity{currencyName='USD', buyingRate='705.67', cashBuyingRate='699.93', sellingRate='708.66', cashSellingRate='708.66', middleRate='704.02', PubTime='2020.04.16 09:19:52'}, TerstEntity{currencyName='USD', buyingRate='705.67', cashBuyingRate='699.93', sellingRate='708.66', cashSellingRate='708.66', middleRate='704.02', PubTime='2020.04.16 09:19:02'}, TerstEntity{currencyName='USD', buyingRate='705.67', cashBuyingRate='699.93', sellingRate='708.66', cashSellingRate='708.66', middleRate='704.02', PubTime='2020.04.16 08:27:20'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 06:52:31'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 05:30:00'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 05:30:00'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 05:30:00'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 00:00:44'}], [TerstEntity{currencyName='USD', buyingRate='705.92', cashBuyingRate='700.18', sellingRate='708.91', cashSellingRate='708.91', middleRate='704.02', PubTime='2020.04.16 09:20:07'}, TerstEntity{currencyName='USD', buyingRate='705.87', cashBuyingRate='700.13', sellingRate='708.86', cashSellingRate='708.86', middleRate='704.02', PubTime='2020.04.16 09:20:02'}, TerstEntity{currencyName='USD', buyingRate='705.67', cashBuyingRate='699.93', sellingRate='708.66', cashSellingRate='708.66', middleRate='704.02', PubTime='2020.04.16 09:19:52'}, TerstEntity{currencyName='USD', buyingRate='705.67', cashBuyingRate='699.93', sellingRate='708.66', cashSellingRate='708.66', middleRate='704.02', PubTime='2020.04.16 09:19:02'}, TerstEntity{currencyName='USD', buyingRate='705.67', cashBuyingRate='699.93', sellingRate='708.66', cashSellingRate='708.66', middleRate='704.02', PubTime='2020.04.16 08:27:20'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 06:52:31'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 05:30:00'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 05:30:00'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 05:30:00'}, TerstEntity{currencyName='USD', buyingRate='705.42', cashBuyingRate='699.68', sellingRate='708.41', cashSellingRate='708.41', middleRate='704.02', PubTime='2020.04.16 00:00:44'}]]

java爬取中国银行汇率数据相关推荐

  1. Java爬取豆瓣电影数据

    所用到的技术有Jsoup,HttpClient. Jsoup jsoup 是一款Java 的HTML解析器,可直接解析某个URL地址.HTML文本内容.它提供了一套非常省力的API,可通过DOM,CS ...

  2. Java爬取京东商品数据

    爬取京东商品数据 我把项目部署到了linux中,进行爬取,爬到了3000条手机信息,只是爬了一些简单的文本信息. 本文爬取的数据为京东手机信息 准备工作 导入爬取数据需要的依赖包 编写httpClie ...

  3. java爬取拉勾网职位数据

    原文出自:自我的青春 笔者说明~~~!!!只用于学习交流,私自用于其他途径,后果自负!!!      1.相关jar准备          fastjson-1.1.41.jar ,jsoup-1.6 ...

  4. java爬取网页的数据并存入数据库

    这里使用Jsoup来实现改功能. demo用到的技术为springboot+jsoup+mysql+mybatis plus 1.首先导入jsoup依赖 <dependency><g ...

  5. 爬取中国银行外汇数据

    import requests import pandas as pd from bs4 import BeautifulSoup import time import csv #构建网页 def g ...

  6. Java爬取豆瓣电影数据,京东高级java面试

    .build(); return config; } 根据请求地址获取响应信息方法,获取成功后返回响应信息. public static String doGetHtml(String url, Ma ...

  7. java 爬取同花顺当日数据

    直接上代码(亲测可用) maven 先引入包 <!--html数据获取--><dependency><groupId>net.sourceforge.htmluni ...

  8. 用java爬取学校数据_Java爬取校内论坛新帖

    Java爬取校内论坛新帖 为了保持消息灵通,博主没事会上上校内论坛看看新帖,作为爬虫爱好者,博主萌生了写个爬虫自动下载的想法. 嗯,这次就选Java. 第三方库准备 Jsoup Jsoup是一款比较好 ...

  9. Jsoup:用Java也可以爬虫,怎么使用Java进行爬虫,用Java爬取网页数据,使用Jsoup爬取数据,爬虫举例:京东搜索

    Jsoup:用Java也可以爬虫,怎么使用Java进行爬虫,用Java爬取网页数据,使用Jsoup爬取数据,爬虫举例:京东搜索 一.资源 为什么接下来的代码中要使用el.getElementsByTa ...

最新文章

  1. all resources based on handshake
  2. 超完美截图工具snipaste的下载使用
  3. 最新完整版PHP配置文件翻译
  4. Exchange Connector 访问报错解决方法一
  5. avalon.js 转义html,avalon模块的内建适配器
  6. 用python解决生活问题_Python解决生活问题之闹钟程序的实现
  7. 创新小组 实战Git团队企操作手册_精华版本
  8. 2.5.1.1、解析配置
  9. 在 Visual Studio 调试器中指定符号 (.pdb) 和源文件
  10. iOS UI自动化测试详解
  11. m3u8格式转换器android,m3u8文件视频转换器(安卓版)
  12. 查看页面密码框明文密码
  13. xp系统搭建iscsi服务器,配置Microsoft Windows XP对MDS/IPS-8的iSCSI主机
  14. 畅购商城项目 订单+用户认证+微信扫码支付+订单处理
  15. TCP长连接和短连接代码及其比较
  16. 开源Linux面板-1Panel
  17. 【笔记】分布式系统核心问题概述(二)
  18. 工程流体力学笔记1(质点导数的公式与定义)
  19. NOIP复习篇———动态规划
  20. 发那科2021参数_发那科系统FANUC:参数修改。

热门文章

  1. room数据库的使用
  2. 学Python容易找工作嘛?
  3. 基于java的俱乐部会员管理系统
  4. 钢绞线的弹性模量的计算方法_钢绞线弹性模量计算
  5. 中科亿海微FPGA应用(一、点灯)
  6. C++ Primer第六版程序清单与习题详解【第二章 开始学习 C++】
  7. m4s格式转换mp3_m4a格式的音频文件怎样转换成MP3格式?
  8. JavaScript的分支语句—— IF语句 解释及基础应用方式;多分支语句switch
  9. FANUC 三菱 HAAS 新代 兄弟等CNC数据采集
  10. NS-3学习笔记 1