Created
October 23, 2013 20:13
-
-
Save kevindavis/7125875 to your computer and use it in GitHub Desktop.
grabs emoji codes and filenames out of the emoji-cheat-sheet.com page and dumps them into a string designed to be pasted into the Yammer emoticon processing stuff
This file contains 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
#!/usr/bin/env ruby | |
# USAGE: ./scraper.rb emoji-cheat-sheet.com/public/index.html | pbcopy | |
# need to check out emoji-cheat-sheet from github | |
# ==> https://github.com/arvida/emoji-cheat-sheet.com | |
filename = ARGV[0] | |
file = File.new(filename, "r") | |
while (line = file.gets) | |
# example line: | |
# <li><div><img src="graphics/emojis/bowtie.png"> :<span class="name">bowtie</span>:</div></li> | |
match = line.match(/emojis\/(.*\.png).*name">(.*?)</) | |
unless match.nil? | |
# example output designed to be pasted into emoticon.js eg. | |
# , ['cat.gif', 'Cat face', ['(@)']] | |
path = match[1] | |
name = match[2].sub(/_/, " ").split.each {|s| s.capitalize!}.join(" ") | |
key = ":" + match[2] + ":" | |
print ", ['" + path + "', '" + name + "', ['" + key + "']]\n" | |
end | |
end | |
file.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment