Fixes embeds for youtube channels (#169)

This commit is contained in:
Aryan Goharzad
2023-02-08 11:10:05 -05:00
committed by GitHub
parent 65f958c128
commit 575cbeb770
4 changed files with 84 additions and 8 deletions
File diff suppressed because one or more lines are too long
+13 -1
View File
@@ -69,7 +69,7 @@ describe('extractHtmlMeta', () => {
expect(output).toEqual(expectedOutput)
})
it('extracts title and description from a generic youtube page', () => {
it.only('extracts title and description from a generic youtube page', () => {
const input = youtubeHTML
const expectedOutput = {
title: 'HD Video (1080p) with Relaxing Music of Native American Shamans',
@@ -81,6 +81,18 @@ describe('extractHtmlMeta', () => {
expect(output).toEqual(expectedOutput)
})
it.only('extracts avatar from a youtube channel', () => {
const input = youtubeHTML
const expectedOutput = {
title: 'penguinz0',
description:
"Clips channel: https://www.youtube.com/channel/UC4EQHfzIbkL_Skit_iKt1aA\n\nTwitter: https://twitter.com/MoistCr1TiKaL\n\nInstagram: https://www.instagram.com/bigmoistcr1tikal/?hl=en\n\nTwitch: https://www.twitch.tv/moistcr1tikal\n\nSnapchat: Hugecharles\n\nTik Tok: Hugecharles\n\nI don't have any other public accounts.",
image: 'https://i.ytimg.com/vi/x6UITRjhijI/sddefault.jpg',
}
const output = extractHtmlMeta({html: input, hostname: 'youtube.com'})
expect(output).toEqual(expectedOutput)
})
it('extracts username from the url a twitter profile page', () => {
const expectedOutput = {
title: '@bluesky on Twitter',