Merge pull request #4207 from omnivore-app/fix/published-date-change-in-wechat
fix/published date change in wechat
This commit is contained in:
@ -15,7 +15,7 @@ export class WeixinQqHandler extends ContentHandler {
|
||||
// Retrieve the publish time
|
||||
const publishTime = dom.querySelector('#publish_time')?.textContent
|
||||
if (publishTime) {
|
||||
const dateTimeFormat = 'yyyy-LL-dd HH:mm'
|
||||
const dateTimeFormat = 'yyyy年LL月dd日 HH:mm'
|
||||
// published time is in UTC+8
|
||||
const publishTimeISO = DateTime.fromFormat(publishTime, dateTimeFormat, {
|
||||
zone: 'Asia/Shanghai',
|
||||
@ -27,16 +27,25 @@ export class WeixinQqHandler extends ContentHandler {
|
||||
metaNode.setAttribute('content', publishTimeISO)
|
||||
dom.querySelector('head')?.appendChild(metaNode)
|
||||
}
|
||||
// This replace the class name of the article info to preserve the block
|
||||
dom
|
||||
.querySelector('.rich_media_meta_list')
|
||||
?.setAttribute('class', '_omnivore_rich_media_meta_list')
|
||||
|
||||
// This removes the title
|
||||
const author = (
|
||||
dom.querySelector('#js_author_name') || dom.querySelector('#js_name')
|
||||
)?.textContent?.trim()
|
||||
if (author) {
|
||||
const authorNode = dom.createElement('meta')
|
||||
authorNode.setAttribute('name', 'author')
|
||||
authorNode.setAttribute('content', author)
|
||||
dom.querySelector('head')?.appendChild(authorNode)
|
||||
}
|
||||
|
||||
// This removes the title, metadata and cover image
|
||||
dom.querySelector('.rich_media_title')?.remove()
|
||||
dom.querySelector('.rich_media_meta_list')?.remove()
|
||||
dom.querySelector('#js_row_immersive_cover_img')?.remove()
|
||||
|
||||
// This removes the profile info
|
||||
dom.querySelector('.profile_container')?.remove()
|
||||
dom.querySelector('.profile_card_container')?.remove()
|
||||
|
||||
// This removes the footer
|
||||
dom.querySelector('#content_bottom_area')?.remove()
|
||||
|
||||
@ -2007,6 +2007,7 @@ Readability.prototype = {
|
||||
metadata.byline = jsonld.byline ||
|
||||
values["dc:creator"] ||
|
||||
values["dcterm:creator"] ||
|
||||
values["og:article:author"] ||
|
||||
values["author"];
|
||||
|
||||
// get description
|
||||
|
||||
Reference in New Issue
Block a user