Title: Find the URL to the 'Favicon' for a Website
Version: 0.1.4
Description: Finds the URL to the 'favicon' for a website. This is useful if you want to display the 'favicon' in an HTML document or web application, especially if the website is behind a firewall.
URL: https://github.com/jdblischak/faviconPlease
BugReports: https://github.com/jdblischak/faviconPlease/issues
Imports: utils, xml2
Suggests: httr, tinytest (≥ 1.0.0), ttdo
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-05-15 18:54:38 UTC; john
Author: John Blischak [aut, cre]
Maintainer: John Blischak <jdblischak@gmail.com>
Repository: CRAN
Date/Publication: 2025-05-15 19:20:02 UTC

Use DuckDuckGo's favicon service

Description

The search engine DuckDuckGo includes site favicons in its search results, and it makes this service publicly available. If it can't find a favicon, it returns a default fallback. faviconPlease uses this as a fallback function if the favicon can't be found directly via the standard methods.

Usage

faviconDuckDuckGo(server)

Arguments

server

The name of the server, e.g. "www.r-project.org"

Value

Character vector

References

DuckDuckGo favicons privacy

See Also

faviconPlease, faviconGoogle

Examples

  faviconDuckDuckGo("reactome.org")


Use Google's favicon service

Description

Use Google's favicon service

Usage

faviconGoogle(server)

Arguments

server

The name of the server, e.g. "www.r-project.org"

Value

Character vector

See Also

faviconPlease, faviconDuckDuckGo

Examples

  faviconGoogle("reactome.org")


Check for the existence of favicon.ico

Description

Check for the existence of favicon.ico

Usage

faviconIco(
  scheme,
  server,
  path,
  method = getOption("download.file.method", default = "auto"),
  extra = getOption("download.file.extra"),
  headers = NULL
)

Arguments

scheme

"http" or "https"

server

The name of the server, e.g. "www.r-project.org"

path

The path to a target file on the server (must start with a forward slash)

method

Method to be used for downloading files. Current download methods are "internal", "libcurl", "wget", "curl" and "wininet" (Windows only), and there is a value "auto": see ‘Details’ and ‘Note’.

The method can also be set through the option "download.file.method": see options().

extra

character vector of additional command-line arguments for the "wget" and "curl" methods.

headers

named character vector of additional HTTP headers to use in HTTP[S] requests. It is ignored for non-HTTP[S] URLs. The User-Agent header taken from the HTTPUserAgent option (see options) is automatically used as the first header.

Value

URL to favicon.ico or "".

See Also

faviconPlease, faviconLink


Description

Search for a link element that specifies the location of the favicon

Usage

faviconLink(scheme, server, path)

Arguments

scheme

"http" or "https"

server

The name of the server, e.g. "www.r-project.org"

path

The path to a target file on the server (must start with a forward slash)

Value

URL to favicon or "".

See Also

faviconPlease, faviconIco


Find the URL to a website's favicon

Description

faviconPlease() first applies the favicon functions specified in the argument functions. If these do not find a favicon URL, then it applies the fallback function specified by the argument fallback.

Usage

faviconPlease(
  links,
  functions = list(faviconLink, faviconIco),
  fallback = faviconDuckDuckGo
)

Arguments

links

Character vector of URLs

functions

List of functions for finding URL to a website's favicon. They are tried in order until a URL is found. If no URL is found, the fallback is applied.

fallback

Either a function or a single character vector. It is applied when none of the supplied functions are able to find a favicon.

Value

Character vector with URLs to the favicons for the websites specified in the input argument links. The URLs are generated from one of the favicon functions specified in the input argument functions. If a favicon URL cannot be identified, then the returned URL is generated by the input argument fallback.

See Also

faviconLink, faviconIco, faviconDuckDuckGo, faviconGoogle