Class: Jekyll::PostCard::Fetcher
- Inherits:
-
Object
- Object
- Jekyll::PostCard::Fetcher
- Defined in:
- lib/jekyll-post-card/fetcher.rb
Overview
Fetches metadata from external URLs using Open Graph, Twitter Cards, and HTML meta tags
Defined Under Namespace
Classes: FetchError, PostMetadata
Constant Summary collapse
- TIMEOUT =
10- USER_AGENT =
"Jekyll-Post-Card/#{VERSION} (+https://github.com/r0x0d/jekyll-post-card)"
Class Method Summary collapse
Class Method Details
.fetch(url) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jekyll-post-card/fetcher.rb', line 31 def fetch(url) uri = validate_url(url) html = fetch_html(uri) (html, uri) rescue FetchError => e PostCard.logger.warn("Failed to fetch metadata for #{url}: #{e.}") (url, e.) rescue StandardError => e PostCard.logger.error("Unexpected error fetching #{url}: #{e.}") (url, "Unexpected error occurred") end |