Sites information parser for the browser and node.js with javascript & typescript
- When you give the site's url to cooparser and then, cooparser will give you the object has some information about that URL
- The information from URL is title, content, link(URL), favicon, thumbnail, provider
- We supports both javascript and typescript
Using npm:
$ npm install cooparser
Using yarn:
$ yarn add cooparser
We use axios for getting data from the site.
So you should use async/await for this library.
The example of javascript code is as follows:
import { cooparser } from 'cooparser';
const getDataAboutURL = async () => {
const data = await cooparser.parse('https://google.com');
// You can see the object here.
console.log(data);
}
getDataAboutURL();
The example of typescript code is as follows:
import { cooparser, ParseResponse } from 'cooparser';
const getDataAboutURL = async () => {
const data:ParseResponse = await cooparser.parse('https://google.com');
// You can see the object here.
console.log(data);
}
getDataAboutURL();
You can see ParseResponse
at next chapter(Response Schema).
The methods we provide are:
interface Cooparser {
parse: (url: string) => Promise<ParseResponse>;
parseList: (urlList: string[]) => Promise<ParseResponse[]>;
}
The response is as follows:
// Parse Response
{
title: string
content: string
link: string
favicon: string
thumbnail: string
provider: string
}
The 'cooparser' could be completed with the help of @jhaemin. Thank you very much to Haemin.