FANZA電子書籍から書誌情報を取得するUserScript
code:disc_fanza.user.js
// ==UserScript==
// @name DISC_FANZA
// @version 0.2
// @description shows how to use babel compiler
// @author motoso
// ==/UserScript==
var inline_src = (<><![CDATA[
var results = [];
const title = document.getElementById('title').innerText;
const url = document.location.href;
const authorElem = document.getElementsByClassName('m-boxDetailProductInfoMainList__description__list')0.innerText.split(" "); const author = authorElem.map(el => [${el}]).join(" ")
const rabel = document.getElementsByClassName('m-boxDetailProductInfo__list__description__item')0.innerText; const publisher = document.getElementsByClassName('m-boxDetailProductInfo__list__description__item')1.innerText; const publishedAt = new Date(document.getElementsByClassName('m-boxDetailProductInfo__list__description')0.innerText); const year = publishedAt.getFullYear();
const month = publishedAt.getMonth() + 1;
const day = publishedAt.getDate();
results.push(title);
results.push([FANZAで読む ${url}]);
results.push([[作家名]]:${author});
results.push([[概要]]:);
results.push([[レーベル]]:[${rabel}]);
results.push([[出版社]]:[${publisher}]);
results.push([[発行年]]:[${year}]/${month}/${day});
// テキストエリアを設置して描画
let textarea = document.createElement('textarea'); textarea.id = 'textarea'; textarea.rows = 11;
let header = document.getElementById('top'); header.appendChild(textarea);
let t = document.getElementById('textarea'); t.value = results.join('\n');
]]></>).toString();
eval(c.code);
更新履歴
2020/4/9 複数人の著者に対応