CLASSAPI/announce
ScrapboxのUserScriptから使える
dependencies
code:script.js
import {login} from '../CLASSAPI%2Flogin/auth.js';
import {postToCLASS} from '../CLASSでページ遷移するscript/scrapbox.js';
import {parse} from '../CLASSのお知らせの本文を取得する/script.js';
code:script.js
export async function getAnnounce(categoryId, announceId, {userId, password}) {
const {html, announceSummary, comSunFacesVIEW} = await login({userId, password});
const {hasHiddenAnnounces} = announceSummary.find(({id}) => id === categoryId);
if (!hasHiddenAnnounces) return await parse(announceId);
// 詳細ページに移動する
await goDetailedInfoPage(comSunFacesVIEW, categoryId);
return await parse(announceId);
}
test code
code:js
(async () => {
const {getAnnounce} = await import('/api/code/takker/CLASSAPI%2Fannounce/script.js');
console.log(await getAnnounce(0, '', {userId: '', password: ''}));
})();