Skip to content
This repository has been archived by the owner on Nov 1, 2019. It is now read-only.

Commit

Permalink
更新弹幕内容正则匹配字符串
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglw committed Apr 6, 2016
1 parent e11fd95 commit 71573c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/me/brucezz/crawler/handler/ResponseParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ResponseParser {
private static final String REGEX_SERVER = "%7B%22ip%22%3A%22(.*?)%22%2C%22port%22%3A%22(.*?)%22%7D%2C";
private static final String REGEX_GROUP_ID = "type@=setmsggroup.*/rid@=(\\d*?)/gid@=(\\d*?)/";
private static final String REGEX_DANMAKU_SERVER = "/ip@=(.*?)/port@=(\\d*?)/";
private static final String REGEX_CHAT_DANMAKU = "type@=chatmessage/.*/sender@=(\\d.*?)/content@=(.*?)/snick@=(.*?)/.*/rid@=(\\d*?)/";
private static final String REGEX_CHAT_DANMAKU = "type@=chatmsg/.*rid@=(\\d*)/.*uid@=(\\d*).*nn@=(.*?)/txt@=(.*?)/(.*)/";


private static Matcher getMatcher(String content, String regex) {
Expand Down Expand Up @@ -120,10 +120,10 @@ public static Danmaku parseDanmaku(String response) {
Danmaku danmaku = null;

if (matcher.find()) {
danmaku = new Danmaku(Integer.parseInt(matcher.group(1)),
danmaku = new Danmaku(Integer.parseInt(matcher.group(2)),
matcher.group(3),
matcher.group(2),
Integer.parseInt(matcher.group(4)));
matcher.group(4),
Integer.parseInt(matcher.group(1)));
}

LogUtil.d("Parse Danmaku", danmaku + "");
Expand Down
2 changes: 1 addition & 1 deletion src/me/brucezz/crawler/thread/CrawlerThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void onReceive(List<String> responses) {
for (String response : responses) {
LogUtil.d("Receive Response", response);

if (!response.contains("chatmessage")) continue;
if (!response.contains("chatmsg")) continue;

//解析弹幕
Danmaku danmaku = ResponseParser.parseDanmaku(response);
Expand Down

0 comments on commit 71573c9

Please sign in to comment.