generate functionMon, 06 Mar 2023

use Nokogiri to get html before assigned tag

def html_before_tag(url, tag) doc = Nokogiri::HTML(open(url)) first_tag = doc.css(tag).first html = doc.to_s.split(first_tag.to_s)[0] end

Questions about programming?Chat with your personal AI assistant