如何获取积分下载

这里推荐一个github上的一个项目,居然可以解锁vip文章和下载文件
源码地址:https://gitcode.com/cuckooplus/csdn_download

HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
 connection.setRequestProperty("connection", "keep-alive");
 connection.setRequestMethod("GET");
 connection.setRequestProperty("Cookie", cookie);
 connection.connect();
 BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
 String inputLine;
 StringBuilder content = new StringBuilder();
 while ((inputLine = in.readLine()) != null) {
     content.append(inputLine);
     content.append("\n");
 }
 in.close();
 connection.disconnect();
 String allContentPlus = content.toString();
 allContentPlus = unicodeToCN(allContentPlus);
 allContentPlus = allContentPlus.replace("\\", "");
 JSONObject allContentPlusJSON = JSONObject.parseObject(allContentPlus);
 JSONObject statusJSON = allContentPlusJSON.getJSONObject("status");
 Integer code = statusJSON.getInteger("code");
 if (code.equals(0)) {
     JSONObject dataJSON = allContentPlusJSON.getJSONObject("data");
     String txt = dataJSON.getString("txt");
     log.info("获取文档内容成功!");
     String resultPro = HttpUtil.get(txt);
     return R.ok(resultPro);
 } else {
     String msg = statusJSON.getString("msg");
     log.info("获取文档内容失败:{}", msg);
     if("复制全文操作每天不超过100次".equals(msg)){
         return R.fail("今天次数已用完,请明天再来!");
     }else if("文档不可复制.".equals(msg)){
         return R.fail("该文档无法复制,请尝试下载!");
     }else {
         return R.fail("请检查地址是否复制正确!");
     }


  • 45
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值