mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Replace got with node-fetch => -1 dependency
This commit is contained in:
parent
d4c3b7ac10
commit
2e6ea62144
@ -1,8 +1,8 @@
|
||||
import Metascraper from 'metascraper'
|
||||
import * as nodeFetch from 'node-fetch'
|
||||
|
||||
import { ApolloError } from 'apollo-server'
|
||||
import parseUrl from 'url'
|
||||
import got from 'got'
|
||||
import request from 'request-promise-native'
|
||||
import find from 'lodash/find'
|
||||
import isEmpty from 'lodash/isEmpty'
|
||||
@ -158,13 +158,9 @@ const scraper = {
|
||||
},
|
||||
async fetchMeta(targetUrl) {
|
||||
|
||||
// const parsedURL = urlParser.parse(targetUrl)
|
||||
// console.log(parsedURL)
|
||||
|
||||
// get from cach
|
||||
|
||||
const { body: html, url } = await got(targetUrl)
|
||||
const metadata = await metascraper({ html, url })
|
||||
const response = await nodeFetch(targetUrl)
|
||||
const html = await response.text()
|
||||
const metadata = await metascraper({ html, url: targetUrl })
|
||||
|
||||
metadata.sources = ['resource']
|
||||
metadata.type = 'link'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user