1
- # '@title refresh the stored public suffix dataset
2
- # '
3
- # '@description \code{urltools} comes with an inbuilt
4
- # 'dataset of public suffixes, \code{\link{suffix_dataset}}.
5
- # 'This is used in \code{\link{suffix_extract}} to identify the top-level domain
6
- # 'within a particular domain name.
7
- # '
8
- # 'While updates to the dataset will be included in each new package release,
9
- # 'there's going to be a gap between changes to TLDs and changes to the package.
10
- # 'Accordingly, the package also includes \code{\link{suffix_refresh}}, which refreshes
11
- # 'this dataset on the user end. This requires CURL (the library, not the
12
- # 'R package) on your system to function.
13
- # '
14
- # '@return TRUE if this worked; an error otherwise.
15
- # '
16
- # '@seealso \code{\link{suffix_extract}} to extract suffixes from domain names,
17
- # 'or \code{\link{suffix_dataset}} for the dataset itself.
18
- # '
19
- # '@examples
20
- # '\dontrun{
21
- # 'suffix_refresh()
22
- # '}
23
- # '
24
- # '@export
25
- suffix_refresh <- function (){
26
-
27
- has_libcurl <- capabilities(" libcurl" )
28
- if (length(has_libcurl ) == 0 || has_libcurl == FALSE ){
29
- stop(" libcurl support is needed for this function" )
30
- }
31
-
32
- # Read in and filter
33
- connection <- url(" https://www.publicsuffix.org/list/effective_tld_names.dat" , method = " libcurl" )
34
- results <- readLines(connection )
35
- close(connection )
36
- suffix_dataset <- results [! grepl(x = results , pattern = " //" , fixed = TRUE ) & ! results == " " ]
37
-
38
- # Return the user-friendly version
39
- save(suffix_dataset , file = system.file(" data/suffix_dataset.rda" , package = " urltools" ))
40
- return (TRUE )
41
- }
42
-
43
1
# ' @title Dataset of public suffixes
44
2
# ' @description This dataset contains a registry of public suffixes, as retrieved from
45
3
# ' and defined by the \href{https://publicsuffix.org/}{public suffix list}. It is
@@ -50,8 +8,7 @@ suffix_refresh <- function(){
50
8
# ' @keywords datasets
51
9
# ' @name suffix_dataset
52
10
# '
53
- # ' @seealso \code{\link{suffix_refresh}} for updating the dataset, and
54
- # ' \code{\link{suffix_extract}} for extracting suffixes from domain names.
11
+ # ' @seealso \code{\link{suffix_extract}} for extracting suffixes from domain names.
55
12
# '
56
13
# ' @usage data(suffix_dataset)
57
14
# ' @note Last updated 2015-05-06.
78
35
# ' "domain" contains the part of the domain name that came before the matched suffix.
79
36
# ' "suffix" is, well, the suffix.
80
37
# '
81
- # ' @seealso \code{\link{suffix_dataset}} for the dataset of suffixes,
82
- # ' and \code{\link{suffix_refresh}} for refreshing it.
38
+ # ' @seealso \code{\link{suffix_dataset}} for the dataset of suffixes.
83
39
# '
84
40
# ' @examples
85
41
# '
0 commit comments