Indieweb::Authorship is a Ruby gem for identifying the author of an IndieWeb post using the authorship algorithm.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install indieweb-authorship
You can simply provide a URL and the page will be retrieved before authorship is determined.
author = Indieweb::Authorship.identify(url)
It is also possible to provide the html directly, along with the URL, in cases where you already have the page.
author = Indieweb::Authorship.identify(url, html)
If an author is identified then the output will be a hash containing the fields
name (for the name of the author),
photo (with a url for a photo of the author), and
url (with a url for the page of the author). Some of these may be
nil, but all will still be provided. If no author can be identified then the output will simply be a
Bug reports can be added at https://code.deeden.co.uk/indieweb-authorship/issues, while patches are welcome at https://code.deeden.co.uk/indieweb-authorship/patches.
The gem is available as open source under the terms of the MIT License.
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.
A number of the spec example files are from...