module

Planeta

Constants

AVATAR_DIR = "public/avatars"
HOSTNAME_PATTERN = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$/
HTML_ENTITIES = {"&amp;" => "&", "&lt;" => "<", "&gt;" => ">", "&quot;" => "\"", "&apos;" => "'", "&#8230;" => "...", "&#8594;" => "->", "&#8592;" => "<-", "&#8216;" => "'", "&#8217;" => "'", "&#8220;" => "\"", "&#8221;" => "\"", "&#8211;" => "-", "&#8212;" => "--", "&#160;" => " ", "&#38;" => "&", "&#60;" => "<", "&#62;" => ">", "&#124;" => "|", "&amp;#124;" => "|"}
HTML_ESCAPE_MAP = {"&" => "&amp;", "<" => "&lt;", ">" => "&gt;", "\"" => "&quot;", "'" => "&#39;"}
MAX_AVATAR_SIZE = 1048576
PRIVATE_IP_PREFIXES = {"10.", "172.16.", "172.17.", "172.18.", "172.19.", "172.20.", "172.21.", "172.22.", "172.23.", "172.24.", "172.25.", "172.26.", "172.27.", "172.28.", "172.29.", "172.30.", "172.31.", "192.168.", "169.254."}
READ_MORE_PATTERNS = [/(?i)\s*sigue leyendo\s*[-–—→]?\s*/, /(?i)\s*read more\s*[-–—→]?\s*/, /(?i)\s*continue reading\s*[-–—→]?\s*/, /(?i)\s*click here to read more\s*/, /<a\s+class=["']more-link["'][^>]*>.*?<\/a>/im, /<a\s+class=["']read-more["'][^>]*>.*?<\/a>/im]
SAFE_URL_PATTERN = /^(https?:\/\/[^\s<]+)$/
VERSION = "0.4.0"

Class methods

cache_dir
Source
cache_dir=(dir : String)
Source
cache_duration
Source
cache_duration=(duration : Time::Span)
Source
cached_feed?(url : String) : Bool
Source
config
Source
decode_html_entities(content : String) : String
Source
detect_feed_type(root : XML::Node) : FeedType
Source
ensure_cache_dir
Source
fetch_feed(url : String) : Array(FeedEntry)

Fetch and parse a single feed with caching

Source
fetch_feeds_concurrent(urls : Array(String)) : Array(FeedEntry)

Fetch feeds concurrently using Crystal fibers for improved performance

This method processes multiple feed URLs in parallel using Crystal's lightweight concurrency model. Each feed is fetched in its own fiber, allowing for efficient utilization of I/O resources.

@param urls [Array(String)] Array of feed URLs to fetch @return [Array(FeedEntry)] Combined array of all feed entries

Source
get_avatar(author : String) : String
Source
html_escape(str : String) : String
Source
init
Source
load_cached_feed(url : String) : Array(FeedEntry)
Source
sanitize_html_content(content : String) : String
Source
sanitize_search_query(query : String) : String
Source
save_cached_feed(url : String, entries : Array(FeedEntry))
Source
strip_html_tags(content : String) : String
Source
validate_url(url : String) : Bool
Source

Nested types