Skip to content

Instantly share code, notes, and snippets.

@tonkotsuboy
Created August 9, 2020 10:44
Show Gist options
  • Save tonkotsuboy/6d4db4792689aa20fa3849a9acfbd81f to your computer and use it in GitHub Desktop.
Save tonkotsuboy/6d4db4792689aa20fa3849a9acfbd81f to your computer and use it in GitHub Desktop.
parse og:image
const parseOgImage = (htmlString: string): string | null => {
return htmlString.match(/property="og:image" content="(?<ogimage>.*)"/iu)
?.groups.ogimage ?? null;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment