Sha256: daeb65bf13befcd485885f73e2c48f75986000c7287b53d4c0973e5e8a011510
Contents?: true
Size: 683 Bytes
Versions: 14
Compression:
Stored size: 683 Bytes
Contents
require 'uri' require 'murlsh' module Murlsh # Try to fetch the content length, content type and title of a url. class AddPre50LookupContentTypeTitle < Plugin @hook = 'add_pre' def self.run(url, config) headers = {} headers['User-Agent'] = config['user_agent'] if config['user_agent'] content_length = url.ask.content_length(:headers => headers) if content_length and not content_length.empty? url.content_length = content_length end url.content_type = url.ask.content_type(:headers => headers) unless url.user_supplied_title? url.title = url.ask.title(:headers => headers) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems