学习
实践
活动
工具
TVP
写文章

java爬虫系列第三讲-获取页面中绝对路径的各种方法

xpath方式获取 log.info("{}", page.getHtml().xpath("//div[@id='cyldata']").links().all()); log.info("{}", ().xpath("//div[@id='cyldata']").css("a", "abs:href").all()); css选择器方式获取 log.info("{}", page.getHtml( ).css("div[id='cyldata']").css("a", "abs:href").all()); log.info("{}", page.getHtml().css("div[id='cyldata ']").links().all()); log.info("{}", page.getHtml().css("div[id='cyldata'] a").links().all()); log.info ("{}", element.attr("abs:href")); log.info("{}", element.absUrl("href")); } jsoup中stringutil工具类方式获取

36420

switch表达式增强,终于可以不写break了!

if (flag == 1) {   log.info("didispace.com: 1"); } else if (flag == 2) {   log.info("didispace.com: 2 "); } else if (flag == 3) {   log.info("didispace.com: 3"); } else if (flag == 4) {   log.info("didispace.com switch(flag) {   case 1:      log.info("didispace.com: 1");      break;   case 2:     log.info("didispace.com : 2");     break;   case 3:     log.info("didispace.com: 3");     break;   case 4:     log.info("didispace.com > log.info("didispace.com: 2");   case 3  -> log.info("didispace.com: 3");   case 4  -> log.info("didispace.com

11510
  • 广告
    关闭

    热门业务场景教学

    个人网站、项目部署、开发环境、游戏服务器、图床、渲染训练等免费搭建教程,多款云服务器20元起。

  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    JMeter 内置日期(时间)函数总结

    ("${__time(,)}"); log.info("${__time(/1000,)}"); # 精确到秒 log.info("${__time(, var)}"); log.info("${var }"); log.info("${__time(yyyyMMdd, var)}"); log.info("${__time(YMD,)}"); log.info("${__time(HHmmss,)}" ); log.info("${__time(HMS,)}"); log.info("${__time(yyyyMMdd-HHmmss,)}"); log.info("${__time(YMDHMS,)} "); log.info("${__time(dd/MM/yyyy,)}"); log.info("${__time(yyyy-MM-dd HH:mm:ss,)}"); log.info("${__time log.info("${__timeShift(,,,,)}"); log.info("${__timeShift(yyyy-MM-dd HH:mm:ss,,,,)}"); // 使用默认日期时间 log.info

    1.1K10

    Spring MVC 处理文件上传

    RequestMethod.POST) @ResponseBody public String fileUpload(HttpServletRequest request) { log.info ("----fileUpload start----"); log.info("className = {}, contextPath = {}, servletPath = {}", ("rest template statusCode = {}, result = {}", value, response.getBody()); } log.info ("rest template statusCode = {}, result = {}", value, response.getBody()); } log.info ("----fileUpload start----"); log.info("className = {}, contextPath = {}, servletPath = {}",

    6720

    让你怀疑人生的重载和重写的区别

    log.info("Parent - Object"); } } class Child extends Parent { void print(String a) { log.info("Child 模糊参数 class Foo { void print(Cloneable a) { log.info("I am cloneable!") ; } void print(Map a) { log.info("I am Map!"); } } 下面打印的是什么? 静态重写 class Parent { static void print() { log.info("I am Parent!") () { log.info("Child::instanceMethod"); } } 打印什么?

    16420

    jsonpath 判断是否包含_JSONPath介绍

    User(“itguang”, “123456”, “123@qq.com”); String username = (String) JSONPath.eval(user, “$.username”); log.info username); Entity entity = new Entity(123, user); User user1 = (User) JSONPath.eval(entity, “$.value”); log.info entities.add(new Entity(“程心”)); //返回集合中多个元素 List names = (List) JSONPath.eval(entities, “$.name”); log.info 返回集合中多个元素names={}”, names); //返回下标 0 和 2 的元素 List result = (List) JSONPath.eval(entities, “[0,2]”); log.info (jsonObject.toString()); //得到所有的书 List books = (List) JSONPath.eval(jsonObject, “$.store.book”); log.info

    9710

    Jmeter系列(68)- BeanShell 内置变量 prev

    getResponseCode 方法声明 public String getResponseCode() 功能 获取响应状态码 栗子代码 sc = prev.getResponseCode() ; log.info 方法声明 public boolean isResponseCodeOK() 功能 判断响应状态码是否为OK对应的状态码(200) 栗子代码 yn = prev.isResponseCodeOK() log.info 或 false getThreadName 方法声明 public String getThreadName() 功能 获取线程名 栗子代码 tname = prev.getThreadName() log.info public String getContentType() 功能 获取取样器响应Content-Type首部字段的值域(包含参数) 栗子代码 ct = prev.getContentType() log.info 方法声明 public String getMediaType() 功能 获取取样器响应Media-Type首部字段的值域(不包含参数) 栗子代码 ct = prev.getMediaType() log.info

    72120

    如何从jdbc中获取数据库建表语句信息(表字段名称表字段类型表字段注释信息表字段长度等等)

    (i + 1)); log.info("java类型:{}", resultSetMetaData.getColumnClassName(i + 1)); log.info("数据库类型:{}", resultSetMetaData.getColumnTypeName (i + 1)); log.info("字段名称:{}", resultSetMetaData.getColumnName(i + 1)); log.info("字段长度:{}", resultSetMetaData.getColumnDisplaySize (i + 1)); log.info("getColumnType:{}", resultSetMetaData.getColumnType(i + 1)); log.info("getPrecision 1)); log.info("getSchemaName:{}", resultSetMetaData.getSchemaName(i + 1)); log.info("getScale:{}", resultSetMetaData.getScale ("COLUMN_NAME:{}", columnName2); log.info("TYPE_NAME:{}", columnType2); log.info("REMARKS:{}", comment2

    10310

    并发编程-04线程安全性之原子性Atomic包的4种类型详解

    ,则以原子方式将该值设置为输入的值 log.info("执行结果:{}" ,value.compareAndSet(8, 11)); // 因为经过了addAndGet,操作之前value的值为8, 8,并不等于5,因此不会更新为11,返回false log.info("value的值:{}" ,value.get()); log.info("value 增长前的值: {}",value.getAndIncrement()); log.info("value的值:{}" ,value.get()); log.info("value 增长后的值:{}",value.incrementAndGet value.lazySet(99); log.info("lazyset value: {}",value.get()); } } 执行结果: ? (0)); // 44+33 log.info("array[0]的值: {}", array[0]); // 11 // 先get ,然后再set,返回set之前的数据 log.info

    13110

    Akka(15): 持久化模式:AtLeastOnceDelivery-消息保证送达模式

    = 0) { results = res :: results confirmDelivery(id) log.info(s"Current (u.deliveryId)} case SaveSnapshotSuccess(m) => log.info(s"Sucessfull saving snapshot: ${m} (s"Saving snapshot failed because: ${cause}") case DeleteMessagesSuccess(toSeq) => log.info saveSnapshot(Snap(results, getDeliverySnapshot)) case Boom => log.info("Boom!") saveSnapshot(Snap(results, getDeliverySnapshot)) case Boom => log.info("Boom!")

    62850

    RabbitMQ使用规范「建议收藏」

    ("=======ConfirmCallback========="); log.info("correlationData = " + correlationData); log.info("ack = " + ack); log.info("cause = " + cause); log.info("=======ConfirmCallback========="); } }); // 开启队列失败确认 ("--------------ReturnCallback----------------"); log.info("message = " + message); log.info("replyCode = " + replyCode); log.info("replyText = " + replyText); log.info("exchange = " + exchange); log.info ("routingKey = " + routingKey); log.info("--------------ReturnCallback----------------"); } }); return

    7720

    使用sp_cursoropen和sp_cursorfetch分页

    cstmt.registerOutParameter(1, Types.INTEGER);    cstmt.registerOutParameter(2, Types.INTEGER);    log.info Types.INTEGER);    cstmt.registerOutParameter(6, Types.INTEGER);    rs = cstmt.executeQuery();    log.info (rs.getMetaData().getColumnCount());    log.info(rs.next());    log.info(cstmt.getInt(1));    int cursor = cstmt.getInt(2);    log.info(cursor);    log.info(cstmt.getInt(4));    log.info(cstmt.getInt (5));    log.info(cstmt.getInt(6));    countSize = cstmt.getInt(6);    countPage = (int) Math.ceil

    22540

    使用sp_cursoropen和sp_cursorfetch分页

    cstmt.registerOutParameter(1, Types.INTEGER);    cstmt.registerOutParameter(2, Types.INTEGER);    log.info Types.INTEGER);    cstmt.registerOutParameter(6, Types.INTEGER);    rs = cstmt.executeQuery();    log.info (rs.getMetaData().getColumnCount());    log.info(rs.next());    log.info(cstmt.getInt(1));    int cursor = cstmt.getInt(2);    log.info(cursor);    log.info(cstmt.getInt(4));    log.info(cstmt.getInt (5));    log.info(cstmt.getInt(6));    countSize = cstmt.getInt(6);    countPage = (int) Math.ceil

    17130

    AMQP-RabbitMQ4路由模式

    ; //向名为为`myExchangeType-direct`,类型为`direct`的Exchange发送20条routingKey为`log.info`的消息 for (int i = 0; i < 20; i++) { channel.basicPublish(ExchangeTypeEnum.DIRECT.getExchangeName(), "log.info ", null, (msg + i + "log.info").getBytes()); log.info("Send msg:[{}] ,routingKey:[{}] success ", (msg + i + "log.info"), "log.info"); } //向名为为`myExchangeType-direct`,类型为`direct`的Exchange发送20 0log.info],routingKey:[log.info],tag:[amq.ctag-69-YK4fbdRWsRxpVYI280A] 17:35:23.157 [pool-1-thread-

    23530

    Java8中计算日期时间差

    @return void **/ private static void testPeriod(LocalDate start, LocalDate end) { log.info (start, end); log.info("[{}~{})之间共有:{}年,{}月,{}日", start, end, period.getYears(), +period.getMonths ("startInstant : {}", startInstant); log.info("endInstant : {}", endInstant); Duration between = Duration.between(startInstant, endInstant); log.info("[{}~{})之间共有:{}天", start, end ("startChronoUnit : {}", start); log.info("endChronoUnit : {}", end); long daysDiff

    1.5K20

    多线程的几种创建方式

    } catch (InterruptedException e) { log.error("创建线程异常:{}",e); } log.info ; new Thread(new Thread02()).start(); log.info("主线程结束......"); } } 运行结果: 3. ; log.info("异步获取到的结果是:{}",s); log.info("主线程结束......"); } } log.info("异步获取到的结果是 ; for (int i=0;i<10;i++) { new Thread(()->{ log.info("当前线程开始:{}" ("当前线程结束: {}",Thread.currentThread()); }).start(); } log.info("主线程结束.....

    6310

    shiro(1)-简介

    value = (String) session.getAttribute("someKey"); if (value.equals("aValue")) { log.info ; } catch (LockedAccountException lae) { log.info("The account for username ; } else { log.info("Hello, mere mortal."); } 接着测试是否有特定的权限 //test a typed Use it wisely."); } else { log.info("Sorry, lightsaber rings are for schwartz masters ; } else { log.info("Sorry, you aren't allowed to drive the 'eagle5' winnebago!")

    44050

    java.util.logging 例子

    args) { Logger log = Logger.getLogger("test"); log.setLevel(Level.INFO); log.info ("--------------------------"); log.info("Test"); log.info("------------------------- Level.INFO); log.addHandler(fileHandler); log.setLevel(Level.INFO); log.info ("One"); log.info("Two"); log.info("Three"); } catch (SecurityException ("One"); log.info("Two"); log.info("Three"); } catch (SecurityException

    42080

    Java AOP实现接口请求日志打印

    ("==================接口请求日志开始=================="); log.info("URL:"+request.getRequestURL() 方法名:" + methodName+"\n" + "请求参数:" + JSON.toJSONString(parameters)); log.info ("==================接口请求日志结束=================="); } catch (Throwable e) { log.info ("==================接口返回日志开始=================="); log.info( "类名:" + className ("异常方法:" + className + "." + methodName + "();参数:" + JSON.toJSONString(parameters)); log.info

    23630

    JPush API Java Library 原

    ("HTTP Status: " + e.getStatus()); LOG.info("Error Code: " + e.getErrorCode()); LOG.info ("HTTP Status: " + e.getStatus()); LOG.info("Error Code: " + e.getErrorCode()); LOG.info Should review and fix it. ", e); LOG.info("HTTP Status: " + e.getStatus()); LOG.info( Should review and fix it. ", e); LOG.info("HTTP Status: " + e.getStatus()); LOG.info( Should review and fix it. ", e); LOG.info("HTTP Status: " + e.getStatus()); LOG.info(

    36220

    扫码关注腾讯云开发者

    领取腾讯云代金券