Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
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
zhiwei
searchhotcrawler
Commits
811c679b
You need to sign in or sign up before continuing.
Commit
811c679b
authored
Oct 31, 2019
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改定时器启动方式
parent
89981f4d
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
45 deletions
+65
-45
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
+3
-3
src/main/java/com/zhiwei/searchhotcrawler/run/HotSearchRun.java
+26
-6
src/main/java/com/zhiwei/searchhotcrawler/timer/BaiduHotSearchRun.java
+6
-6
src/main/java/com/zhiwei/searchhotcrawler/timer/DouyinHotSearchRun.java
+6
-6
src/main/java/com/zhiwei/searchhotcrawler/timer/SougoHotSearchRun.java
+6
-6
src/main/java/com/zhiwei/searchhotcrawler/timer/WeiboHotSearchRun.java
+6
-6
src/main/java/com/zhiwei/searchhotcrawler/timer/WeiboTopicRun.java
+6
-6
src/main/java/com/zhiwei/searchhotcrawler/timer/ZhihuHotSearchRun.java
+6
-6
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
View file @
811c679b
...
...
@@ -142,20 +142,20 @@ public class WeiboHotSearchCrawler {
rank
++;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"解析微博时时热搜时出现解析错误"
,
e
.
fillInStackTrace
());
logger
.
error
(
"解析微博时时热搜时出现解析错误"
,
e
);
continue
;
}
}
return
result
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"解析微博时时热搜时出现解析错误,数据不是json结构"
,
e
.
fillInStackTrace
());
logger
.
error
(
"解析微博时时热搜时出现解析错误,数据不是json结构"
,
e
);
return
Collections
.
emptyList
();
}
}
else
{
logger
.
info
(
"解析微博时时热搜时出现解析错误,页面结构有问题"
);
}
}
catch
(
IOException
e1
)
{
logger
.
error
(
"解析微博时时热搜时出现连接失败"
,
e1
.
fillInStackTrace
());
logger
.
error
(
"解析微博时时热搜时出现连接失败"
,
e1
);
return
Collections
.
emptyList
();
}
return
Collections
.
emptyList
();
...
...
src/main/java/com/zhiwei/searchhotcrawler/run/HotSearchRun.java
View file @
811c679b
...
...
@@ -15,6 +15,10 @@ import com.zhiwei.searchhotcrawler.timer.WeiboTopicRun;
import
com.zhiwei.searchhotcrawler.timer.ZhihuHotSearchRun
;
import
com.zhiwei.tools.tools.ZhiWeiTools
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
public
class
HotSearchRun
{
...
...
@@ -25,13 +29,29 @@ public class HotSearchRun {
new
UpdateWechatUserRun
().
start
();
ZhiWeiTools
.
sleep
(
10000
);
new
CacheListener
().
startListen
();
ScheduledExecutorService
scheduledThreadPool
=
Executors
.
newScheduledThreadPool
(
6
);
scheduledThreadPool
.
scheduleAtFixedRate
(
new
WeiboHotSearchRun
(),
0
,
1
,
TimeUnit
.
MINUTES
);
scheduledThreadPool
.
scheduleAtFixedRate
(
new
BaiduHotSearchRun
(),
0
,
5
,
TimeUnit
.
MINUTES
);
scheduledThreadPool
.
scheduleAtFixedRate
(
new
SougoHotSearchRun
(),
0
,
5
,
TimeUnit
.
MINUTES
);
scheduledThreadPool
.
scheduleAtFixedRate
(
new
DouyinHotSearchRun
(),
0
,
10
,
TimeUnit
.
MINUTES
);
scheduledThreadPool
.
scheduleAtFixedRate
(
new
ZhihuHotSearchRun
(),
0
,
10
,
TimeUnit
.
MINUTES
);
scheduledThreadPool
.
scheduleAtFixedRate
(
new
WeiboTopicRun
(),
0
,
1
,
TimeUnit
.
DAYS
);
//采集程序启动
new
WeiboHotSearchRun
().
start
();
new
BaiduHotSearchRun
().
start
();
new
SougoHotSearchRun
().
start
();
new
DouyinHotSearchRun
().
start
();
new
ZhihuHotSearchRun
().
start
();
new
WeiboTopicRun
().
start
();
// new WeiboHotSearchRun().start();
// new BaiduHotSearchRun().start();
// new SougoHotSearchRun().start();
// new DouyinHotSearchRun().start();
// new ZhihuHotSearchRun().start();
// new WeiboTopicRun().start();
//推送程序启动
new
SendWeiboHotSearchRun
().
start
();
new
SendZhihuHotSearchRun
().
start
();
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/BaiduHotSearchRun.java
View file @
811c679b
...
...
@@ -22,17 +22,17 @@ public class BaiduHotSearchRun extends Thread{
@Override
public
void
run
()
{
boolean
f
=
true
;
while
(
f
)
{
// boolean f = true;
// while(f) {
try
{
getHotList
();
TimeUnit
.
MINUTES
.
sleep
(
5
);
// TimeUnit.MINUTES.sleep(5);
}
catch
(
Exception
e
)
{
e
.
fillInStackTrace
();
ZhiWeiTools
.
sleep
(
60
*
60
*
1000
);
}
ZhiWeiTools
.
sleep
(
50
);
// ZhiWeiTools.sleep(60*60*1000);
}
// ZhiWeiTools.sleep(50);
// }
}
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/DouyinHotSearchRun.java
View file @
811c679b
...
...
@@ -21,17 +21,17 @@ public class DouyinHotSearchRun extends Thread{
@Override
public
void
run
()
{
boolean
f
=
true
;
while
(
f
)
{
// boolean f = true;
// while(f) {
try
{
getHotList
();
TimeUnit
.
MINUTES
.
sleep
(
10
);
// TimeUnit.MINUTES.sleep(10);
}
catch
(
Exception
e
)
{
e
.
fillInStackTrace
();
ZhiWeiTools
.
sleep
(
60
*
60
*
1000
);
}
ZhiWeiTools
.
sleep
(
50
);
// ZhiWeiTools.sleep(60*60*1000);
}
// ZhiWeiTools.sleep(50);
// }
}
/**
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/SougoHotSearchRun.java
View file @
811c679b
...
...
@@ -20,17 +20,17 @@ public class SougoHotSearchRun extends Thread {
@Override
public
void
run
()
{
boolean
f
=
true
;
while
(
f
)
{
// boolean f = true;
// while(f) {
try
{
getHotList
();
TimeUnit
.
MINUTES
.
sleep
(
5
);
// TimeUnit.MINUTES.sleep(5);
}
catch
(
Exception
e
)
{
e
.
fillInStackTrace
();
ZhiWeiTools
.
sleep
(
60
*
60
*
1000
);
}
ZhiWeiTools
.
sleep
(
50
);
// ZhiWeiTools.sleep(60*60*1000);
}
// ZhiWeiTools.sleep(50);
// }
}
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/WeiboHotSearchRun.java
View file @
811c679b
...
...
@@ -21,17 +21,17 @@ public class WeiboHotSearchRun extends Thread{
@Override
public
void
run
()
{
boolean
f
=
true
;
while
(
f
)
{
// boolean f = true;
// while(f) {
try
{
getHotList
();
TimeUnit
.
MINUTES
.
sleep
(
1
);
// TimeUnit.MINUTES.sleep(1);
}
catch
(
Exception
e
)
{
e
.
fillInStackTrace
();
ZhiWeiTools
.
sleep
(
60
*
1000
);
}
ZhiWeiTools
.
sleep
(
50
);
// ZhiWeiTools.sleep(60*1000);
}
// ZhiWeiTools.sleep(50);
// }
}
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/WeiboTopicRun.java
View file @
811c679b
...
...
@@ -21,17 +21,17 @@ public class WeiboTopicRun extends Thread{
@Override
public
void
run
()
{
boolean
f
=
true
;
while
(
f
)
{
// boolean f = true;
// while(f) {
try
{
getTopicList
();
TimeUnit
.
DAYS
.
sleep
(
1
);
// TimeUnit.DAYS.sleep(1);
}
catch
(
Exception
e
)
{
e
.
fillInStackTrace
();
ZhiWeiTools
.
sleep
(
60
*
60
*
1000
);
}
ZhiWeiTools
.
sleep
(
50
);
// ZhiWeiTools.sleep(60*60*1000);
}
// ZhiWeiTools.sleep(50);
// }
}
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/ZhihuHotSearchRun.java
View file @
811c679b
...
...
@@ -20,17 +20,17 @@ public class ZhihuHotSearchRun extends Thread{
@Override
public
void
run
()
{
boolean
f
=
true
;
while
(
f
)
{
// boolean f = true;
// while(f) {
try
{
getHotList
();
TimeUnit
.
MINUTES
.
sleep
(
10
);
// TimeUnit.MINUTES.sleep(10);
}
catch
(
Exception
e
)
{
e
.
fillInStackTrace
();
ZhiWeiTools
.
sleep
(
60
*
60
*
1000
);
}
ZhiWeiTools
.
sleep
(
50
);
// ZhiWeiTools.sleep(60*60*1000);
}
// ZhiWeiTools.sleep(50);
// }
}
...
...
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