-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
789 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="lib" path="F:/JavaSpace/jcq-coolq-1.2.7.jar"/> | ||
<classpathentry kind="lib" path="F:/JavaSpace/jsoup-1.12.1.jar"/> | ||
<classpathentry kind="lib" path="F:/JavaSpace/htmlunit-2.25-OSGi.jar"/> | ||
<classpathentry kind="lib" path="F:/JavaSpace/json-20180813.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>KQPlugin</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/cn/mcplugin/kqjcq/Main.java=UTF-8 | ||
encoding//src/cn/mcplugin/kqjcq/SickWebSite.java=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# rbqrobort | ||
### 这是一个RBQ机器人插件,配套使用酷Q,基于JCQ插件,以及JCQ框架 | ||
#### 主要功能: | ||
+ ##### 获取实时全国新型冠状肺炎地区分布地图和地区确诊信息 | ||
+ ##### 为武汉加油点赞(触发词:武汉 && (加油 / 点赞) | ||
+ ##### 发送已经保存过的全国热点迁移地图 | ||
#### 因为是自产自销的插件,所以代码可读性和性能比较差,见谅。 | ||
#### 需要用到的目录也是绝对定位的 | ||
###### (C:\\Users\\Administrator\\Desktop\\image) | ||
###### (C:\\Users\\Administrator\\Desktop\\image\\wh) | ||
|
||
###### 更新日期:2020-01-27 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Submodule rbqrobort
deleted from
3610f0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package cn.mcplugin.kqjcq; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.http.HttpEntity; | ||
import org.apache.http.HttpResponse; | ||
import org.apache.http.client.entity.UrlEncodedFormEntity; | ||
import org.apache.http.client.methods.HttpPost; | ||
import org.apache.http.impl.client.DefaultHttpClient; | ||
import org.apache.http.util.EntityUtils; | ||
import org.json.HTTP; | ||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
import org.jsoup.Jsoup; | ||
import org.jsoup.nodes.Document; | ||
@SuppressWarnings("all") | ||
public class JsonInfo implements Runnable{ | ||
public static String jsonStr = null; | ||
final static String api = "https://www.tianqiapi.com/api?version=epidemic&appid=23035354&appsecret=8YvlPNrz"; | ||
public static void main(String[] args) { | ||
getDocument(); | ||
System.out.println(getGlobalInfo()); | ||
} | ||
|
||
public String getCityInfo(String city) {return null;} | ||
|
||
public static String getGlobalInfo() { | ||
JSONObject j = new JSONObject(jsonStr); | ||
JSONObject arr = j.getJSONObject("data"); | ||
String finalStr = "数据更新至:"+arr.getString("date")+"\n" | ||
+"确诊病例:"+arr.getInt("diagnosed")+"\n" | ||
+"疑似病例:"+arr.getInt("suspect")+"\n" | ||
+"治愈人数:"+arr.getInt("cured")+"\n" | ||
+"死亡病例:"+arr.getInt("death"); | ||
|
||
|
||
return finalStr; | ||
|
||
|
||
|
||
} | ||
|
||
public static void getDocument() { | ||
//实例化defaultHttpClient | ||
DefaultHttpClient hc=new DefaultHttpClient(); | ||
try { | ||
//实例化post方式访问并且把路径放入 | ||
HttpPost httppost=new HttpPost(api); | ||
//把需要的参数传入 | ||
//执行访问返回resp | ||
HttpResponse resp=hc.execute(httppost); | ||
//获取访问的结果 | ||
HttpEntity entity=resp.getEntity(); | ||
//把返回的结果转成字符串 | ||
jsonStr = EntityUtils.toString(entity); | ||
|
||
} catch (Exception e) { | ||
// TODO: handle exception | ||
e.printStackTrace(); | ||
}//运行完后执行 | ||
finally { | ||
hc.getConnectionManager().shutdown(); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void run() { | ||
getDocument(); | ||
try { | ||
Thread.sleep(1000*600); | ||
} catch (InterruptedException e) { | ||
// TODO 自动生成的 catch 块 | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package cn.mcplugin.kqjcq; | ||
|
||
import java.awt.image.BufferedImage; | ||
import java.awt.image.RenderedImage; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import javax.imageio.ImageIO; | ||
import javax.swing.JEditorPane; | ||
import javax.swing.JPanel; | ||
import javax.swing.SwingUtilities; | ||
|
||
import org.jsoup.Jsoup; | ||
import org.jsoup.nodes.Document; | ||
import org.jsoup.nodes.Element; | ||
import org.jsoup.select.Elements; | ||
|
||
public class MCPlugin { | ||
public void htmlTurnImage(String html) throws Exception { | ||
JEditorPane ed = new JEditorPane(html); | ||
ed.setSize(200,200); | ||
|
||
//create a new image | ||
BufferedImage image = new BufferedImage(ed.getWidth(), ed.getHeight(), | ||
BufferedImage.TYPE_INT_ARGB); | ||
|
||
//paint the editor onto the image | ||
SwingUtilities.paintComponent(image.createGraphics(), | ||
ed, | ||
new JPanel(), | ||
0, 0, image.getWidth(), image.getHeight()); | ||
//save the image to file | ||
ImageIO.write((RenderedImage)image, "jpg", new File("F:\\Desktop\\new.jpg")); | ||
} | ||
public String getHtml() throws IOException { | ||
String a = null; | ||
String b = null; | ||
String url = "https://3g.dxy.cn/newh5/view/pneumonia"; | ||
Document doc = Jsoup.connect(url) | ||
.header("Accept", "*/*") | ||
//.header("Connection:", "keep-alive")//如果是这种方式,这里务必带上 | ||
.header("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36")//伪装Chrome浏览器 | ||
.timeout(30000)//超时时间30秒 | ||
.get(); | ||
Elements es = doc.getElementsByTag("p"); | ||
for(Element e : es) { | ||
if(e.className().contains("mapTitle___")); | ||
a = e.toString(); | ||
System.out.println(a); | ||
break; | ||
} | ||
for(Element e : es) { | ||
if(e.className().contains("confirmedNumber")) { | ||
b = e.toString(); | ||
System.out.println(b); | ||
break; | ||
} | ||
} | ||
return a+"\n"+b; | ||
|
||
} | ||
public static void main(String[] args) throws Exception { | ||
MCPlugin mc = new MCPlugin(); | ||
//String c = mc.getHtml(); | ||
//mc.htmlTurnImage(c); | ||
JEditorPane ed = new JEditorPane(new URL("https://www.mcplugin.cn")); | ||
ed.setSize(2000,2000); | ||
|
||
//create a new image | ||
BufferedImage image = new BufferedImage(ed.getWidth(), ed.getHeight(), | ||
BufferedImage.TYPE_INT_ARGB); | ||
|
||
//paint the editor onto the image | ||
SwingUtilities.paintComponent(image.createGraphics(), | ||
ed, | ||
new JPanel(), | ||
0, 0, image.getWidth(), image.getHeight()); | ||
ImageIO.write((RenderedImage)image, "png", new File("F:\\Desktop\\html.png")); | ||
|
||
} | ||
} |
Oops, something went wrong.