mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix: pornhub pubDate (#14232)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const { art } = require('@/utils/render');
|
||||
const { join } = require('path');
|
||||
const { parseRelativeDate } = require('@/utils/parse-date');
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
const defaultDomain = 'https://www.pornhub.com';
|
||||
|
||||
@@ -10,6 +11,10 @@ const headers = {
|
||||
};
|
||||
|
||||
const renderDescription = (data) => art(join(__dirname, 'templates/description.art'), data);
|
||||
const extractDateFromImageUrl = (imageUrl) => {
|
||||
const matchResult = imageUrl.match(/(\d{6})\/(\d{2})/);
|
||||
return matchResult ? matchResult.slice(1, 3).join('') : null;
|
||||
};
|
||||
|
||||
const parseItems = (e) => ({
|
||||
title: e.find('span.title a').text().trim(),
|
||||
@@ -19,7 +24,7 @@ const parseItems = (e) => ({
|
||||
previewVideo: e.find('img').data('mediabook'),
|
||||
}),
|
||||
author: e.find('.usernameWrap a').text(),
|
||||
pubDate: parseRelativeDate(e.find('.added').text()),
|
||||
pubDate: dayjs(extractDateFromImageUrl(e.find('img').data('mediumthumb'))) || parseRelativeDate(e.find('.added').text()),
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user