Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weibohotcrawler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenweiyang
weibohotcrawler
Commits
2c117f0d
Commit
2c117f0d
authored
Aug 22, 2019
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新去重条件
parent
fc0b457a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
2 deletions
+62
-2
pom.xml
+2
-2
src/main/java/com/zhiwei/weibocrawler/rsidClient/RsidRedisClient.java
+60
-0
No files found.
pom.xml
View file @
2c117f0d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.zhiwei
</groupId>
<groupId>
com.zhiwei
</groupId>
<artifactId>
weibohotcrawler
</artifactId>
<artifactId>
weibohotcrawler
</artifactId>
<version>
0.0.
8
-SNAPSHOT
</version>
<version>
0.0.
9
-SNAPSHOT
</version>
<name>
weibohotcrawler
</name>
<name>
weibohotcrawler
</name>
<description>
微博热搜1小时榜单,社会、热点采集程序
</description>
<description>
微博热搜1小时榜单,社会、热点采集程序
</description>
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<dependency>
<dependency>
<groupId>
com.zhiwei
</groupId>
<groupId>
com.zhiwei
</groupId>
<artifactId>
weibobusiness
</artifactId>
<artifactId>
weibobusiness
</artifactId>
<version>
0.0.
6
-SNAPSHOT
</version>
<version>
0.0.
7
-SNAPSHOT
</version>
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
src/main/java/com/zhiwei/weibocrawler/rsidClient/RsidRedisClient.java
0 → 100644
View file @
2c117f0d
package
com
.
zhiwei
.
weibocrawler
.
rsidClient
;
import
org.apache.log4j.Logger
;
import
com.zhiwei.base.category.ClassD.TypeD
;
import
com.zhiwei.common.config.GroupType
;
import
com.zhiwei.middleware.cleaner.filter.UnifiedFilterClient
;
import
com.zhiwei.weibocrawler.config.Config
;
public
class
RsidRedisClient
{
private
static
UnifiedFilterClient
client
;
static
Logger
log
=
Logger
.
getLogger
(
RsidRedisClient
.
class
.
getName
());
static
{
if
(
client
==
null
){
synchronized
(
RsidRedisClient
.
class
)
{
if
(
client
==
null
)
{
try
{
client
=
UnifiedFilterClient
.
getClient
(
Config
.
zookeeper
,
Config
.
group
,
GroupType
.
PROVIDER
);
}
catch
(
Exception
e
)
{
log
.
error
(
"链接清洗中间件时出现错误,错误为:::{}"
,
e
);
}
}
}
}
}
public
static
boolean
isNotDuplicated
(
String
mid
)
{
try
{
return
client
.
uniqueContains
(
mid
,
TypeD
.
新浪微博
);
}
catch
(
Exception
e
)
{
try
{
Thread
.
sleep
(
3000L
);
return
isNotDuplicatedTry
(
mid
);
}
catch
(
Exception
ex
)
{
log
.
error
(
mid
+
" 重复URL过滤错误:"
+
ex
.
getMessage
());
return
true
;
}
}
}
private
static
boolean
isNotDuplicatedTry
(
String
mid
)
throws
Exception
{
return
client
.
uniqueContains
(
mid
,
TypeD
.
新浪微博
);
}
// private static SendMail mail = new SendMail();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment