Skip to content

Commit

Permalink
Merge 38c88eb into ce035ba
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Mar 13, 2023
2 parents ce035ba + 38c88eb commit cad20b5
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 17,232 deletions.
Empty file modified packages/cheerio-repl/bin/index.mjs
100644 → 100755
Empty file.
24 changes: 6 additions & 18 deletions packages/metascraper-date/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,9 @@ const dateRules = () => {
toDate($ => $('[itemprop*="date" i]').attr('content')),
toDate($ => $('time[itemprop*="date" i]').attr('datetime')),
toDate($ => $('time[datetime]').attr('datetime')),
toDate($ => $('meta[name*="dc.date" i]').attr('content')),
toDate($ => $('meta[name*="dcterms.date" i]').attr('content')),
toDate($ => $('[property*="dc:date" i]').attr('content')),
toDate($ => $filter($, $('[class*="byline" i]'))),
toDate($ => $filter($, $('[class*="dateline" i]'))),
toDate($ => $filter($, $('[id*="metadata" i]'))),
toDate($ => $filter($, $('[class*="metadata" i]'))), // twitter, move into a bundle of rules
toDate($ => $filter($, $('[id*="date" i]'))),
toDate($ => $filter($, $('[class*="date" i]'))),
toDate($ => $filter($, $('[id*="post-timestamp" i]'))),
toDate($ => $filter($, $('[class*="post-timestamp" i]'))),
toDate($ => $filter($, $('[id*="post-meta" i]'))),
toDate($ => $filter($, $('[class*="post-meta" i]'))),
toDate($ => $filter($, $('[id*="time" i]'))),
toDate($ => $filter($, $('[class*="time" i]')))
]
}
Expand All @@ -33,13 +22,7 @@ const datePublishedRules = () => {
toDate($jsonld('datePublished')),
toDate($jsonld('dateCreated')),
toDate($ => $('meta[property*="published_time" i]').attr('content')),
toDate($ => $('meta[property*="release_date" i]').attr('content')),
toDate($ => $('[itemprop="datepublished" i]').attr('content')),
toDate($ => $('time[datetime][pubdate]').attr('datetime')),
toDate($ => $('meta[name*="dc.date.issued" i]').attr('content')),
toDate($ => $('meta[name*="dc.date.created" i]').attr('content')),
toDate($ => $('[property*="dc:created" i]').attr('content')),
toDate($ => $filter($, $('[id*="publish" i]'))),
toDate($ => $filter($, $('[class*="publish" i]')))
]
}
Expand All @@ -53,7 +36,12 @@ const dateModifiedRules = () => {
]
}

module.exports = ({ datePublished, dateModified } = { datePublished: false, dateModified: false }) => {
module.exports = (
{ datePublished, dateModified } = {
datePublished: false,
dateModified: false
}
) => {
const result = {
date: dateModifiedRules().concat(datePublishedRules(), dateRules())
}
Expand Down
1 change: 1 addition & 0 deletions packages/metascraper/test/integration/twitter-gif/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { resolve } = require('path')
const test = require('ava')

const metascraper = require('../../..')([
require('metascraper-twitter')(),
require('metascraper-author')(),
require('metascraper-date')(),
require('metascraper-description')(),
Expand Down
7,999 changes: 198 additions & 7,801 deletions packages/metascraper/test/integration/twitter-gif/input.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Generated by [AVA](https://avajs.dev).
{
audio: null,
author: 'Kikobeats',
date: '2017-06-28T21:01:00.000Z',
description: '“Experimenting with Clearbit API + Apple TV 3D Parallax https://t.co/Qsm163k4mJ https://t.co/5bcuqoEyAa”',
image: 'https://pbs.twimg.com/profile_images/876748424690925568/14xPNAvw_400x400.jpg',
author: '#!/kiko/beats',
date: '2017-06-28T19:01:34.000Z',
description: '“Experimenting with Clearbit API + Apple TV 3D Parallax https://t.co/Qsm163k4mJ”',
image: 'https://pbs.twimg.com/tweet_video_thumb/DDbh3WCXYAAZfz9.jpg:large',
lang: 'en',
logo: 'https://abs.twimg.com/icons/apple-touch-icon-192x192.png',
logo: 'https://abs.twimg.com/responsive-web/client-web/icon-ios.b1fc727a.png',
publisher: 'Twitter',
title: 'K I K O B E A T S ⚡️ on Twitter',
title: '@Kikobeats on Twitter',
url: 'https://twitter.com/Kikobeats/status/880139124791029763',
video: null,
video: 'https://video.twimg.com/tweet_video/DDbh3WCXYAAZfz9.mp4',
}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { resolve } = require('path')
const test = require('ava')

const metascraper = require('../../..')([
require('metascraper-twitter')(),
require('metascraper-author')(),
require('metascraper-date')(),
require('metascraper-description')(),
Expand Down
Loading

0 comments on commit cad20b5

Please sign in to comment.