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
08d4afee
Commit
08d4afee
authored
Nov 25, 2019
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微博热搜添加区分推荐位icon字段
parent
5b2136e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
189 additions
and
171 deletions
+189
-171
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchList.java
+188
-170
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
+0
-1
src/main/java/com/zhiwei/searchhotcrawler/timer/WeiboHotSearchRun.java
+1
-0
No files found.
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchList.java
View file @
08d4afee
package
com
.
zhiwei
.
searchhotcrawler
.
bean
;
package
com
.
zhiwei
.
searchhotcrawler
.
bean
;
/**
/**
* @ClassName: WeiboHotSearch
* @ClassName: WeiboHotSearch
* @Description: TODO(微博时时热搜)
* @Description: TODO(微博时时热搜)
* @author hero
* @author hero
* @date 2017年9月26日 下午5:41:11
* @date 2017年9月26日 下午5:41:11
*/
*/
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
import
com.zhiwei.tools.timeparse.TimeParse
;
import
com.zhiwei.tools.timeparse.TimeParse
;
public
class
HotSearchList
implements
Serializable
{
public
class
HotSearchList
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2076919584659821600L
;
private
static
final
long
serialVersionUID
=
2076919584659821600L
;
private
String
id
;
//主键
private
String
id
;
//主键
private
String
url
;
//消息链接
private
String
url
;
//消息链接
private
String
name
;
//热搜关键词
private
String
name
;
//热搜关键词
private
Integer
count
;
//时时热搜量
private
Integer
count
;
//时时热搜量
private
Boolean
hot
;
//状态(true 为热搜; false为时时上升)
private
Boolean
hot
;
//状态(true 为热搜; false为时时上升)
private
String
day
;
//天
private
String
day
;
//天
private
Date
time
;
//时间
private
Date
time
;
//时间
private
Integer
changeCount
;
//据上分钟变化量
private
Integer
changeCount
;
//据上分钟变化量
private
Integer
rank
;
//排名
private
Integer
rank
;
//排名
private
String
type
;
//分类
private
String
type
;
//分类
private
String
icon
;
//热搜类型
public
HotSearchList
(){}
public
HotSearchList
(
String
url
,
String
name
,
Integer
count
,
Boolean
hot
,
Integer
rank
,
String
type
){
public
HotSearchList
(){}
this
.
id
=
name
+
"_"
+
new
Date
().
getTime
();
this
.
url
=
url
;
public
HotSearchList
(
String
url
,
String
name
,
Integer
count
,
Boolean
hot
,
Integer
rank
,
String
type
,
String
icon
){
this
.
name
=
name
;
this
.
id
=
name
+
"_"
+
new
Date
().
getTime
();
this
.
count
=
count
;
this
.
url
=
url
;
this
.
hot
=
hot
;
this
.
name
=
name
;
this
.
rank
=
rank
;
this
.
count
=
count
;
this
.
time
=
new
Date
();
this
.
hot
=
hot
;
this
.
day
=
TimeParse
.
dateFormartString
(
new
Date
(),
"yyyy-MM-dd"
);
this
.
rank
=
rank
;
this
.
type
=
type
;
this
.
time
=
new
Date
();
}
this
.
day
=
TimeParse
.
dateFormartString
(
new
Date
(),
"yyyy-MM-dd"
);
this
.
type
=
type
;
this
.
icon
=
icon
;
public
HotSearchList
(
String
url
,
String
name
,
Integer
count
,
Integer
rank
,
String
type
){
}
this
.
id
=
name
+
"_"
+
new
Date
().
getTime
();
this
.
url
=
url
;
this
.
name
=
name
;
public
HotSearchList
(
String
url
,
String
name
,
Integer
count
,
Integer
rank
,
String
type
){
this
.
count
=
count
;
this
.
id
=
name
+
"_"
+
new
Date
().
getTime
();
this
.
hot
=
true
;
this
.
url
=
url
;
this
.
rank
=
rank
;
this
.
name
=
name
;
this
.
time
=
new
Date
();
this
.
count
=
count
;
this
.
day
=
TimeParse
.
dateFormartString
(
new
Date
(),
"yyyy-MM-dd"
);
this
.
hot
=
true
;
this
.
type
=
type
;
this
.
rank
=
rank
;
}
this
.
time
=
new
Date
();
this
.
day
=
TimeParse
.
dateFormartString
(
new
Date
(),
"yyyy-MM-dd"
);
this
.
type
=
type
;
@Override
}
public
String
toString
(){
return
"new HotSearchList["
+
"id = "
+
id
@Override
+
", url = "
+
url
public
String
toString
(){
+
", name = "
+
name
return
"new HotSearchList["
+
", count = "
+
count
+
"id = "
+
id
+
", time = "
+
time
+
", url = "
+
url
+
", hot = "
+
hot
+
", name = "
+
name
+
", rank = "
+
rank
+
", count = "
+
count
+
", day = "
+
day
+
", time = "
+
time
+
", changeCount = "
+
changeCount
+
", hot = "
+
hot
+
", type = "
+
type
+
", rank = "
+
rank
+
"]"
;
+
", day = "
+
day
}
+
", changeCount = "
+
changeCount
+
", type = "
+
type
+
", icon = "
+
icon
public
String
getId
()
{
+
"]"
;
return
id
;
}
}
public
void
setId
(
String
id
)
{
public
String
getId
()
{
this
.
id
=
id
;
return
id
;
}
}
public
String
getUrl
()
{
public
void
setId
(
String
id
)
{
return
url
;
this
.
id
=
id
;
}
}
public
void
setUrl
(
String
url
)
{
public
String
getUrl
()
{
this
.
url
=
url
;
return
url
;
}
}
public
String
getName
()
{
public
void
setUrl
(
String
url
)
{
return
name
;
this
.
url
=
url
;
}
}
public
void
setName
(
String
name
)
{
public
String
getName
()
{
this
.
name
=
name
;
return
name
;
}
}
public
Integer
getCount
()
{
public
void
setName
(
String
name
)
{
return
count
;
this
.
name
=
name
;
}
}
public
void
setCount
(
Integer
count
)
{
public
Integer
getCount
()
{
this
.
count
=
count
;
return
count
;
}
}
public
Date
getTime
()
{
public
void
setCount
(
Integer
count
)
{
return
time
;
this
.
count
=
count
;
}
}
public
void
setTime
(
Date
time
)
{
public
Date
getTime
()
{
this
.
time
=
time
;
return
time
;
}
}
public
Integer
getChangeCount
()
{
public
void
setTime
(
Date
time
)
{
return
changeCount
;
this
.
time
=
time
;
}
}
public
void
setChangeCount
(
Integer
changeCount
)
{
public
Integer
getChangeCount
()
{
this
.
changeCount
=
changeCount
;
return
changeCount
;
}
}
public
static
long
getSerialversionuid
()
{
public
void
setChangeCount
(
Integer
changeCount
)
{
return
serialVersionUID
;
this
.
changeCount
=
changeCount
;
}
}
public
Boolean
isHot
()
{
public
static
long
getSerialversionuid
()
{
return
hot
;
return
serialVersionUID
;
}
}
public
void
setHot
(
Boolean
hot
)
{
public
Boolean
isHot
()
{
this
.
hot
=
hot
;
return
hot
;
}
}
public
String
getDay
()
{
public
void
setHot
(
Boolean
hot
)
{
return
day
;
this
.
hot
=
hot
;
}
}
public
void
setDay
(
String
day
)
{
public
Boolean
getHot
()
{
this
.
day
=
day
;
return
hot
;
}
}
public
Integer
getRank
()
{
public
String
getIcon
()
{
return
rank
;
return
icon
;
}
}
public
void
setRank
(
Integer
rank
)
{
public
void
setIcon
(
String
icon
)
{
this
.
rank
=
rank
;
this
.
icon
=
icon
;
}
}
public
String
getType
()
{
public
String
getDay
()
{
return
type
;
return
day
;
}
}
public
void
setType
(
String
type
)
{
public
void
setDay
(
String
day
)
{
this
.
type
=
type
;
this
.
day
=
day
;
}
}
}
public
Integer
getRank
()
{
return
rank
;
}
public
void
setRank
(
Integer
rank
)
{
this
.
rank
=
rank
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
View file @
08d4afee
...
@@ -109,7 +109,6 @@ public class WeiboHotSearchCrawler {
...
@@ -109,7 +109,6 @@ public class WeiboHotSearchCrawler {
String
url
=
"https://m.weibo.cn/api/container/getIndex?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&title=%E5%BE%AE%E5%8D%9A%E7%83%AD%E6%90%9C&extparam=pos%3D0_0%26mi_cid%3D100103%26cate%3D10103%26filter_type%3Drealtimehot%26c_type%3D30&luicode=10000011&lfid=231583"
;
String
url
=
"https://m.weibo.cn/api/container/getIndex?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&title=%E5%BE%AE%E5%8D%9A%E7%83%AD%E6%90%9C&extparam=pos%3D0_0%26mi_cid%3D100103%26cate%3D10103%26filter_type%3Drealtimehot%26c_type%3D30&luicode=10000011&lfid=231583"
;
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
headerMap
.
put
(
"User-Agent"
,
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
);
headerMap
.
put
(
"User-Agent"
,
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
);
String
htmlBody
;
String
htmlBody
;
try
{
try
{
List
<
HotSearchList
>
result
=
new
ArrayList
<
HotSearchList
>();
List
<
HotSearchList
>
result
=
new
ArrayList
<
HotSearchList
>();
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/WeiboHotSearchRun.java
View file @
08d4afee
...
@@ -55,6 +55,7 @@ public class WeiboHotSearchRun extends Thread{
...
@@ -55,6 +55,7 @@ public class WeiboHotSearchRun extends Thread{
doc
.
put
(
"changeCount"
,
changeCount
);
doc
.
put
(
"changeCount"
,
changeCount
);
doc
.
put
(
"rank"
,
weiboHotSearch
.
getRank
());
doc
.
put
(
"rank"
,
weiboHotSearch
.
getRank
());
doc
.
put
(
"type"
,
weiboHotSearch
.
getType
());
doc
.
put
(
"type"
,
weiboHotSearch
.
getType
());
doc
.
put
(
"icon"
,
weiboHotSearch
.
getIcon
());
data
.
add
(
doc
);
data
.
add
(
doc
);
}
}
weiboHotSearchDAO
.
addHotSearchList
(
data
);
weiboHotSearchDAO
.
addHotSearchList
(
data
);
...
...
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