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
7fe19a3c
Commit
7fe19a3c
authored
Sep 29, 2018
by
[zhangzhiwei]
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改微博热搜解析规则
parent
2c471a78
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
+3
-4
src/main/java/com/zhiwei/searchhotcrawler/run/HotSearchRun.java
+2
-2
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
View file @
7fe19a3c
...
...
@@ -62,11 +62,10 @@ public class WeiboHotSearchCrawler {
Elements
elements
=
document
.
select
(
"div#pl_top_realtimehot"
).
select
(
"tbody"
).
select
(
"tr"
);
for
(
Element
element
:
elements
){
try
{
String
id
=
"http://s.weibo.com"
+
element
.
select
(
"
p.star_name
"
).
select
(
"a"
).
attr
(
"href"
);
String
name
=
element
.
select
(
"
p.star_name
"
).
select
(
"a"
).
text
();
String
num
=
!
element
.
select
(
"
p.star_num"
).
text
().
equals
(
""
)?
element
.
select
(
"p.star_num
"
).
text
():
"0"
;
String
id
=
"http://s.weibo.com"
+
element
.
select
(
"
td.td-02
"
).
select
(
"a"
).
attr
(
"href"
);
String
name
=
element
.
select
(
"
td.td-02
"
).
select
(
"a"
).
text
();
String
num
=
!
element
.
select
(
"
td.td-03"
).
text
().
equals
(
""
)?
element
.
select
(
"td.td-03
"
).
text
():
"0"
;
int
hotCount
=
Integer
.
valueOf
(
num
);
WeiboHotSearch
hotSearch
=
new
WeiboHotSearch
(
id
,
name
,
hotCount
,
true
);
list
.
add
(
hotSearch
);
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/zhiwei/searchhotcrawler/run/HotSearchRun.java
View file @
7fe19a3c
...
...
@@ -27,7 +27,7 @@ public class HotSearchRun {
public
static
void
main
(
String
[]
args
)
{
new
HotSearchRun
().
showTimer
();
new
CacheListener
().
startListen
();
new
SendWeiboHotSearchRun
().
start
();
new
SendZhihuHotSearchRun
().
start
();
//
new SendWeiboHotSearchRun().start();
//
new SendZhihuHotSearchRun().start();
}
}
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