public class WebScraping
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
(专用程序包) java.util.LinkedList<java.lang.String> |
OthersLL |
(专用程序包) java.util.LinkedList<java.lang.String> |
TimeLL |
构造器和说明 |
---|
WebScraping(int pagenum) |
限定符和类型 | 方法和说明 |
---|---|
private void |
addOtherData(java.lang.String result)
Scrap the data id, latitude, longitude, depth, magnitude and region
from the String result, then generate a String containing those
data, and add it to the LinkedList OthersLL.
|
private void |
addTimeData(java.lang.String result)
Scrap the time data
from the String result, then generate a String containing those
data, and add it to the LinkedList TimeLL.
|
private void |
GetData(int pagenum)
Scrap the data of time, id, latitude, longitude, depth, magnitude and region
from the certain page of the web site "https://www.emsc-csem.org"
|
java.sql.Timestamp |
getEarliest()
Get the earliest data from the web and return its time as a Timestamp.
|
java.sql.Timestamp |
getLatest()
Get the latest data from the web and return its time as a Timestamp.
|
java.util.LinkedList<java.lang.String> |
getOthersLL()
get the LinkedList containing the data of infomation except time.
|
private java.sql.Timestamp |
getTime(java.lang.String time)
Change the String with the format of "yyyy-MM-dd HH:mm:ss" into a Timestamp
with the same time information.
|
java.util.LinkedList<java.lang.String> |
getTimeLL()
get the LinkedList containing the data of time.
|
private java.util.regex.Matcher |
RegexString(java.lang.String targetStr,
java.lang.String patternStr)
To search useful information from pattern text using regular expression,
and return a object of class Matcher.
|
private java.lang.String |
SendGet(java.lang.String url)
This method scrap the source code of the web site of the url, then return it
as a string.
|
java.util.LinkedList<java.lang.String> TimeLL
java.util.LinkedList<java.lang.String> OthersLL
public java.util.LinkedList<java.lang.String> getTimeLL()
public java.util.LinkedList<java.lang.String> getOthersLL()
public java.sql.Timestamp getLatest()
public java.sql.Timestamp getEarliest()
private java.sql.Timestamp getTime(java.lang.String time)
time
- - the target String.private java.lang.String SendGet(java.lang.String url)
url
- - the url of the web we want to scrap.private java.util.regex.Matcher RegexString(java.lang.String targetStr, java.lang.String patternStr)
targetStr
- - the regular expression used for searching.patternStr
- - the pattern text we get data from.private void GetData(int pagenum)
pagenum
- - the page number users want to search.private void addTimeData(java.lang.String result)
result
- - The pattern text used to search for data.private void addOtherData(java.lang.String result)
result
- - The pattern text used to search for data.