Skip to content

perma.cc support #36

@Denubis

Description

@Denubis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions