Automatically retrieve PDFs from pubmed search entries

Hi,

I am new to DevonThink and I am still trying to figure out how I can do certain jobs better. I often use DevonAgent to retrieve Pubmed entries to a certain topic (e.g. MET receptor). I get like up to 100 hits and import them to DT as resource. Most of the entries have available pdfs of the articles. Is there a way to retrieve the pdfs for all the 100 entries in DT automatically. I know how to do it manually but it takes a long time. Is it better to do this in Bookends and then bring them into DT?

Thanks,
Marco

1 Like

How do you download it manually? The URL of a result having PDFs would be useful.

It’s a multi step process. After I imported the journal resource page to DT:

I have to click on full text links after that and choose the source e.g.

Then I have to click on the pdf format source:

When you use Bookends or Endnote they can scrape the pdf directly from the citation in pubmed. I don’t know how they do it but would be great if DT could do the same.

Thanks,
Marco

This can be scripted, e.g. the following script checks whether one of the selected items in DEVONthink is a PubMed result and then tries to add the download to the download manager:

-- Download PDFs from PubMed

tell application id "DNtp"
	repeat with theRecord in selected records
		set theURL to URL of theRecord
		if theURL begins with "https://pubmed.ncbi.nlm.nih.gov/" then
			set theSource to download markup from theURL
			repeat with theLink in (get links of theSource base URL theURL)
				if theLink begins with "https://www.mdpi.com/resolver?pii=" then
					set theSource to download markup from theLink
					repeat with theDownload in (get links of theSource base URL theLink)
						if theDownload ends with "/pdf" then add download theDownload
					end repeat
					exit repeat
				end if
			end repeat
		end if
	end repeat
end tell

A revision of this script could be also used in smart rules so that this could be automatically performed after adding results to DEVONthink.

4 Likes

Thank you so much. I will test it later. One more question: The part in the script that is directing to a special journal in this case mdpi. Would there be a way to keep it as general as possible so that it can get the pdf file from any journal that is catalogued in pubmed. I am new to DT and still try to figure out what can be done by scripts and what not.

The script and its conditions could of course be extended. But it needs a way to figure out which links should be used.

Thanks Christian. I think I have to become first more experienced in DT 3 before I am able to change the script but working on it :slight_smile:

Marco