Internet Archive Pdf Download Link

generate a button for borrowed Internet Archive books.

Size

1.5 KB

Version

1.0.1

Created

Nov 3, 2025

Updated

about 1 month ago

1// ==UserScript==
2// @name		Internet Archive Pdf Download Link
3// @namespace		http://tampermonkey.net/
4// @version		1.0.1
5// @description		generate a button for borrowed Internet Archive books.
6// @author		BA
7// @match		https://archive.org/details/*
8// @icon		data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
9// @grant		none
10// @license		MIT
11// @downloadURL		https://update.greasyfork.org/scripts/447027/Internet%20Archive%20Pdf%20Download%20Link.user.js
12// @updateURL		https://update.greasyfork.org/scripts/447027/Internet%20Archive%20Pdf%20Download%20Link.meta.js
13// ==/UserScript==
14(function() {
15    'use strict';
16
17
18    window.addEventListener('load', () => {
19        addButton('Download PDF', downloadAcsmFn);
20    });
21
22    function addButton(text, onclick, cssObj) {
23
24        const button = document.createElement('button');
25        const titleEl = document.getElementById('IABookReaderMessageWrapper');
26        titleEl.appendChild(button);
27        button.innerHTML = text;
28        button.onclick = onclick;
29        return button;
30    }
31
32    function downloadAcsmFn() {
33
34        const currentUrl = document.URL;
35        const urlPartRaw = [...currentUrl.match(/org\/details\/(.*)/)];
36        if (urlPartRaw.length > 0) {
37            const identifier = urlPartRaw[1].split('/')[0];
38            const acsmUrl = 'https://archive.org/services/loans/loan/?action=media_url&identifier=' + identifier + '&format=pdf&redirect=1';
39            window.open(acsmUrl, '_blank');
40        }
41
42    }
43
44
45})();
Internet Archive Pdf Download Link | Robomonkey