embiggen icon indicating copy to clipboard operation
embiggen copied to clipboard

perma.cc support

Open Denubis opened this issue 5 years ago • 2 comments

Hi Folks...

I'm wondering if you could add perma.cc to embiggen. While perma.cc isn't strictly a link shortener, for purposes of altmetrics, it's usually desirable to look at the parent page.

def parsePermaCC(incomingurl)
	if incomingurl.include? "perma.cc"
		archive = incomingurl.split("perma.cc/")[1]

		# https://perma.cc/docs/developer#get-one-archive
		url = "https://api.perma.cc/v1/public/archives/#{archive}"
		uri = URI(url)
		response = JSON.parse(Net::HTTP.get(uri))
		return URI(response['url'])
	else
		return incomingurl
	end
end

this is some ruby I hacked up (I usually code in python, so... this is probably all sorts of badwrong) which takes a uri and finds the perma.cc parent url or just passes the url through if not perma.cc'd. I'm thinking an invocation for this can go into follow()

Let me know if this is something you folks would like to include here, or if I should go raise a ticket in altmetric for this.

Cheers, -Brian

Denubis avatar Jan 31 '19 02:01 Denubis

Hey Brian, I'd like to add support for it into Altmetric indeed, I have my reckons about putting it here on Embiggen though. Will discuss further with the team and let you know. Thanks for sending!

jbilbo avatar Jan 31 '19 10:01 jbilbo

No worries. It isn't an amazing fit for enbiggen since it isn't... quite a link shortener. Let me know how I can help though. Hopefully my proof of concept above is useful. Oh, and I opened a ticket with support on your end: 90862

Denubis avatar Jan 31 '19 10:01 Denubis