class NetworkProfile::ResearchgateProfile
Public Class Methods
handle?(link)
click to toggle source
# File lib/network_profile/extractors/researchgate_profile.rb, line 5 def self.handle?(link) link['researchgate.net/profile/'] end
Public Instance Methods
extra_data()
click to toggle source
# File lib/network_profile/extractors/researchgate_profile.rb, line 35 def extra_data card = doc.at(".profile-content-item .nova-c-card") return {} unless card items, reads, citations = card. search(".nova-o-grid__column"). map { |col| col.search('.nova-e-text').map(&:text) }. map(&:first).map { |i| i.gsub(',', '').to_i } { items: items, reads: reads, citations: citations, last_item: last_item } end
json_ld()
click to toggle source
Calls superclass method
NetworkProfile::DefaultProfile#json_ld
# File lib/network_profile/extractors/researchgate_profile.rb, line 9 def json_ld original = super if original['@graph'] original['@graph'].first else original end end
last_item()
click to toggle source
# File lib/network_profile/extractors/researchgate_profile.rb, line 26 def last_item item = rdf.find { |_, v| v['type'].to_s['ScholarlyArticle'] }.last return unless item title = item.dig('<http://schema.org/headline>', 0) date = item.dig('<http://schema.org/datePublished>', 0) "#{title} (#{date})" end
text()
click to toggle source
# File lib/network_profile/extractors/researchgate_profile.rb, line 22 def text json_ld.dig('affiliation', 'name') || doc.at('.org')&.text end
title()
click to toggle source
# File lib/network_profile/extractors/researchgate_profile.rb, line 18 def title json_ld['name'] end