Created
October 22, 2015 04:43
-
-
Save waitingallday/592396a81edd665f8af2 to your computer and use it in GitHub Desktop.
This is what I used for featuring an image in the feed display ("today" tab), it matches the first image in the feed content body
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
recordset.each do |entry| | |
# Some other stuff | |
# ... | |
image_field = 'content' # 'description' in rss | |
unless entry[image_field].nil? | |
img = entry[image_field].match(/<img.+?src=[\"'](.+?)[\"'].*?>/) | |
unless img.nil? | |
item[:image] = raw.merge(img[1]).to_s | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment