You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{load}from'cheerio'constfetchTargetText=(url: string): Promise<string>=>{returnnewPromise((resolve,reject)=>{fetch(url).then((r)=>r.text()).then((res)=>{resolve(res)}).catch((e)=>{reject(e)})})}constconstresolveText=(text: string)=>{const$=load(text)lett=$('meta')letaa=$('meta[property="og:"]')console.log(t);// ? The length of the content obtained here is 0console.log(aa);}construn=async()=>{lettext=awaitfetchTargetText(url)returnresolveText(text)}run()
The text was updated successfully, but these errors were encountered:
base example
use live-server start a local web site
nodejs code
The text was updated successfully, but these errors were encountered: