logo scrape
1.0.0
徽標刮擦
LogoScrape
從 Node.js 應用程式提供的 URL 中抓取徽標。
查看演示以查看其實際效果!
安裝
進口
用法
應用程式介面
示範
執照
$ npm i 標誌抓取
const { LogoScrape } = require('logo-scrape');
從 'logo-scrape' 導入 { LogoScrape };
getLogo()
或getLogos()
接受 url 並傳回所提供 url 的輸出
(async () => {const url = 'http://techcrunch.com';const 徽標 =等待LogoScrape.getLogo(url);const 徽標=等待LogoScrape.getLogos(url);console.log({徽標, 徽標});const urls = ['http://techcrunch.com' , 'http://producthunt.com'];const logoUrls =等待LogoScrape.getLogo(urls);const logosUrls =等待LogoScrape.getLogos(urls); console.log({logoUrls, logosUrls});})();
將輸出以下結果;
{“標誌”:{“類型”:“link-rel/icon”,“url”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png ?w=32","尺寸": "32x32" }, 「標誌」: [ {“類型”:“link-rel/icon”,“網址”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=32” ,「尺寸」:「32x32」}, {“類型”:“link-rel/icon”,“網址”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=192” ,「尺寸」:「192x192」}, {“類型”:“link-rel/icon”,“網址”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=180” }, {“類型”:“元名稱/msapplication-TileImage”,“網址”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w= 270 "}, {“類型”:“og:image”,“網址”:“https://techcrunch.com/wp-content/themes/techcrunch-2017/images/opengraph-default.png”} ] }
對於多個 url
{「標誌網址」:[ {“類型”:“link-rel/icon”,“網址”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=32” ,「尺寸」:「32x32」}, {“類型”:“link-rel/icon”,“網址”:“https://assets.producthunt.com/assets/ph-ios-icon-e1733530a1bfc41080db8161823f1ef262cdbbc933800c0a2a706f70png” ], "logosUrls": [ [ {“type”:“link-rel/icon”,“url”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=32” ,“尺寸”:“32x32”}, {“type”:“link-rel/icon”,“url”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=192” ,“尺寸”:“192x192”}, {“type”:“link-rel/icon”,“url”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=180” }, {“類型”:“元名稱/msapplication-TileImage”,“url”:“https://techcrunch.com/wp-content/uploads/2015/02/cropped-cropped-favicon-gradient.png?w=第270章 {“type”:“og:image”,“url”:“https://techcrunch.com/wp-content/themes/techcrunch-2017/images/opengraph-default.png”} ], [ {"type": "link-rel/icon","url": "https://assets.producthunt.com/assets/ph-ios-icon-e1733530a1bfc41080db8161823f1ef262cdbbc933800c0a2a70670png {"type": "link-rel/icon","url": "https://www.producthunt.com/favicon.ico" }, {“類型”:“og:圖像”,“url”:“https://www.producthunt.comhttps://api.url2png.com/v6/P5329C1FA0ECB6/790272390317dc724643b1ca88f5da6e/httpspng/2url %2Fwww.producthunt.com%2F" }, {"type": "svg:image","data": true,"url": "data:image/svg+xml,%3Csvg%20width%3D%2240%22%20height%3D%2240%22%20viewBox %3D%220%200%2040%2040%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%2% %3D%22evenodd%22%3E%3Cpath%20d%3D%22M40%2020c0%2011.046-8.954%2020-20%2020S0%2031.046%200%2020%208% 020%2020% 22 %20fill%3D%22%23DA552F%22%2F%3E%3Cpath%20d%3D%22M22.667%2020H17v-6h5.667a3%203%200%200%201%2000%206.100%200%200%201%2006%206. 207 %200%201%200%200-14%22%20fill%3D%22%23FFF%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"} ] ] }
使用 TypeDoc 產生的 API 可以在此處找到。
請隨意提交拉取請求、建立問題或傳播訊息。
麻省理工學院©弗里茨‧霍斯特