Skip to content

Instantly share code, notes, and snippets.

@sckott
Created March 4, 2014 15:38
Show Gist options
  • Save sckott/9348745 to your computer and use it in GitHub Desktop.
Save sckott/9348745 to your computer and use it in GitHub Desktop.
# Title: scopusfilter.rb
# Author: Scott Chamberlain, @sckott
# Licence: MIT
# Description: Uses HTTParty
#
# Example use:
#
# {{ '10.1016/j.actao.2009.04.001' | scopus }}
require 'httparty'
module Jekyll
module ScopusCounts
def scopus(input)
stuff = input
base = 'http://api.elsevier.com/content/search/index:SCOPUS'
doi = 'DOI(' + stuff + ')'
args = {"query" => doi, "field" => "citedby-count", "apiKey" => "90893053a48a42459bb1ab0a65e18394"}
out = HTTParty.get(base, :query => args)
puts out['search-results']['entry'][0]['citedby-count']
end
end
end
Liquid::Template.register_filter(Jekyll::ScopusCounts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment