Fixes youtube embed issues (#50)
* fixes youtube embed * move extractMetaHtml test to its own file * tests cleanup * Add fallback for youtube meta data * lint * Check for youtube in the url domain * use hostname instead of full url to check for link domain * checks only for domain
This commit is contained in:
parent
9230d52ff5
commit
f10a8308d9
12 changed files with 245 additions and 149 deletions
|
@ -1,7 +1,8 @@
|
|||
import he from 'he'
|
||||
import {extractHtmlMeta, isBskyAppUrl} from './strings'
|
||||
import {isBskyAppUrl} from './strings'
|
||||
import {RootStoreModel} from '../state'
|
||||
import {extractBskyMeta} from './extractBskyMeta'
|
||||
import {extractHtmlMeta} from './extractHtmlMeta'
|
||||
|
||||
export enum LikelyType {
|
||||
HTML,
|
||||
|
@ -59,7 +60,10 @@ export async function getLinkMeta(
|
|||
})
|
||||
const httpResBody = await httpRes.text()
|
||||
clearTimeout(to)
|
||||
const httpResMeta = extractHtmlMeta(httpResBody)
|
||||
const httpResMeta = extractHtmlMeta({
|
||||
html: httpResBody,
|
||||
hostname: urlp?.hostname,
|
||||
})
|
||||
meta.title = httpResMeta.title ? he.decode(httpResMeta.title) : undefined
|
||||
meta.description = httpResMeta.description
|
||||
? he.decode(httpResMeta.description)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue