Created
July 15, 2020 08:18
-
-
Save KisaragiEffective/6ed1306bcd7e0a67c8a1d78b7d871ff2 to your computer and use it in GitHub Desktop.
parse web color dict.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "nokogiri" | |
require "open-uri" | |
html = open("https://www.colordic.org") | |
doc = Nokogiri::HTML.parse(html, nil, "UTF-8") | |
# [0]: html color name, [1]: actual color code headed '#' | |
doc.css('table')[0].css("td").map {|x| x.css("a")[0].inner_html.split("<br>") } | |
# TODO: other format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment