Files
RSSHub/lib/v2/sigsac/ccs.js
T
Zeddy ac02f3ede6 feat(route): add seccon (#11498)
* add seccon

* add seccon

* add seccon

* add seccon

* delete seccon under the lib/v2/ folder and divide it by domain

* fix wrong path

* Update lib/v2/ieee-security/sp.js

* Update lib/v2/ieee-security/sp.js

* Update lib/v2/ieee-security/sp.js

* Update lib/v2/ieee-security/sp.js

* Update lib/v2/sigsac/ccs.js

* Update lib/v2/sigsac/ccs.js

* Update lib/v2/usenix/usenix.js

* Update lib/v2/usenix/usenix.js

* Update lib/v2/usenix/usenix.js

* Update lib/v2/sigsac/ccs.js

* Update lib/v2/usenix/usenix.js

* Update lib/v2/usenix/usenix.js

* Update lib/v2/usenix/usenix.js

* ignore eslint

* add parseDate lib and edit doc

* add ndss

* uniform variable name style

* Update docs/journal.md

* Update lib/v2/ieee-security/radar.js

* Update lib/v2/ieee-security/radar.js

* Update lib/v2/usenix/radar.js

* Update lib/v2/ieee-security/radar.js

* Update lib/v2/sigsac/radar.js

* Update lib/v2/ndss-symposium/radar.js

* fix ndss

* docs: add en docs

* docs: fix closing tag
2022-12-29 22:26:04 +08:00

58 lines
2.2 KiB
JavaScript

const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = 'https://www.sigsac.org/';
const { parseDate } = require('@/utils/parse-date');
// https://www.sigsac.org/ccs/CCS2022/program/accepted-papers.html
module.exports = async (ctx) => {
const last = new Date().getFullYear() + 1;
const yearList = Array.from({ length: last - 2020 }, (_, v) => `${url}ccs/CCS${v + 2020}/`);
const yearResponses = await got.all(yearList.map((url) => got(url)));
const urlList = yearResponses.map((response) => {
const $ = cheerio.load(response.data);
return new URL($('a:contains("Accepted Papers")').attr('href'), response.url).href;
});
const responses = await got.all(urlList.map((url) => got(url)));
const items = responses.map((response) => {
const $ = cheerio.load(response.data);
const link = response.url;
const paperSection = $('div.papers-item')
.toArray()
.map((item) => {
item = $(item);
const title = item.find('b').text().trim();
return {
title,
author: item.find('p').text().trim().replaceAll('\n', '').replace(/\s+/g, ' '),
link: `${link}#${title}`,
pubDate: parseDate(link.match(/CCS(\d{4})/)[1], 'YYYY'),
};
});
const paperTable = $('tbody tr')
.toArray()
.slice(1) // skip table header
.map((item) => {
item = $(item);
const title = item.find('td').eq(0).text().trim();
return {
title,
author: item.find('td').eq(1).text().trim().replaceAll('\n', '').replace(/\s+/g, ' '),
link: `${link}#${title}`,
pubDate: parseDate(link.match(/CCS(\d{4})/)[1], 'YYYY'),
};
});
return paperSection.length ? paperSection : paperTable;
});
ctx.state.data = {
title: 'ACM CCS',
link: url,
description: 'The ACM Conference on Computer and Communications Security (CCS) Accepted Papers',
allowEmpty: true,
item: items.flat(),
};
};