rss category support (#1015)

also do a bit fix of [solidot] feed
This commit is contained in:
sgqy 2018-10-31 11:02:01 +08:00 committed by DIYgod
parent 0aed6e9b20
commit 7e8d66eacd
3 changed files with 10 additions and 16 deletions

View File

@ -46,19 +46,14 @@ module.exports = async (ctx) => {
const cat_img = $(a[i])
.find('div.icon_float > a')
.html();
const date_raw = $(a[i]).find('div.talk_time');
$(date_raw)
.find('div.icon_float')
.remove();
$(date_raw)
.find('span.user')
.remove();
$(date_raw)
.find('b')
.remove();
const date_str_zh = $(date_raw)
.text()
.replace(/^[^`]*发表于(.*分)[^`]*$/g, '$1'); // use [^`] to match \n
const date_raw = $(a[i])
.find('div.talk_time')
.clone()
.children()
.remove()
.end()
.text();
const date_str_zh = date_raw.replace(/^[^`]*发表于(.*分)[^`]*$/g, '$1'); // use [^`] to match \n
const date_str = date_str_zh
.replace(/[年月]/g, '-')
.replace(/时/g, ':')

View File

@ -59,9 +59,7 @@
{{ /if }}
{{ if $e.category }}
{{ each $e.category $c }}
<category term="{{ $c }}"></category>
{{ /each }}
<category term="{{ $e.category }}"></category>
{{ /if }}
</entry>

View File

@ -33,6 +33,7 @@
{{ if $value.enclosure_url }}<enclosure url="{{ $value.enclosure_url }}" length="{{ $value.enclosure_length }}" type="{{ $value.enclosure_type }}" />{{ /if }}
{{ if $value.itunes_duration }}<itunes:duration>{{ $value.itunes_duration }}</itunes:duration> {{ /if }}
{{ if $value.author }}<author><![CDATA[{{ $value.author }}]]></author>{{ /if }}
{{ if $value.category }}<category>{{ $value.category }}</category>{{ /if }}
</item>
{{ /each }}
</channel>