ilake Chang

Most of time you could get the thumbnail from the original url, using something like https://github.com/tgezginis/video_thumb to get the thumbnail url. But something you couldn’t, at that time, you could use service something like https://noembed.com/ to get url.

module ThumbnailOfVideo
def self.get(url)
begin
response = URI.open("https://noembed.com/embed?url=#{url}").read
result = JSON.parse(response)if result && result["thumbnail_url"]
result["thumbnail_url"].sub('height=100', 'height=480')
end
rescue StandardError
nil
end
end
end

--

--

ilake Chang

ilake Chang

Senior Rails developer, full stack developer, react-native junior, flutter player.