Scrape website information that title, meta, page capture, description, ogp and so on.
Add this line to your application's Gemfile:
gem 'website_information'
And then execute:
$ bundle
Or install it yourself as:
$ gem install website_information
Please install chromedriver(webdriver) if you want to use site capture.
Install chromedriver. https://chromedriver.storage.googleapis.com/ or brew install chromedriver
If you use this gem in heroku, please install relational buildpacks (https://github.com/heroku/heroku-buildpack-chromedriver.git, https://github.com/heroku/heroku-buildpack-google-chrome.git) and your language's fontconfig to ./fonts
scraped_params = WebsiteInformation::Website.new('scraping_url(ex. https://www.google.com)').scraped_params
# ex) get website title
scraped_params.title # => Google
The list of allowed get params
values.
.title
—<title>
tag value.meta.description
—<meta name="description" >
tag content.meta.keyword
—<meta name="keyword" >
tag content.og.site_name
—<meta property="og:site_name" >
tag content.og.description
—<meta property="og:description" >
tag content.og.url
—<meta property="og:url" >
tag content.og.type
—<meta property="og:type" >
tag content.og.image
—<meta property="og:image" >
tag content.favicon
—<link rel="shortcut icon" >
tag href image/ico type.feed
—<link rel="alternate" >
tag href application/atom+xml or application/rss+xml type.sns.facebook
— Facebook page plugin (https://developers.facebook.com/docs/plugins/page-plugin/) from data-href.sns.twitter
— Twitter embedded timelines (https://dev.twitter.com/web/embedded-timelines/list) from href
Bug reports and pull requests are welcome on GitHub at https://github.com/miraoto/website_information. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the WebsiteInformation project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.