LoginSignup
0
0

More than 1 year has passed since last update.

Thumbalizr APIでウェブサイトのサムネイル

Posted at

ウェブサイトのサムネイル画像を提供するAPIです。

FREEプランもあり、100回/月が使えます。

https://www.thumbalizr.com/features
image.png
2021年10月時点で

サイトにサンプルコードがありますが、Python3では動作しませんでした。
下記はPython3で動作確認しています。

sample.py
import hashlib
import urllib.parse


def thumbalizr(url='', options={}):
  embed_key = 'your_embed_key' # replace it with you Embed API key
  secret = 'your_secret' # replace it with your Secret

  query = 'url=' + urllib.parse.quote(url)

  for key, value in options.items():
    query += '&' + key + '=' + urllib.parse.quote(str(value))

  token = hashlib.md5((query + secret).encode('utf-8')).hexdigest()

  return "https://api.thumbalizr.com/api/v1/embed/%s/%s/?%s" % (embed_key, token, query)

print (thumbalizr("https://www.yahoo.co.jp/wordpress/", { 'width': 300, 'size': 'page' }))

コードに埋め込むAPIは、ユーザーのProrileページ(https://thumbalizr.com/member/profile)で確認できます。
Secretは非表示になっており、"show"のリンク押下で表示されます。

image.png

サンプルを実行すると、下記のようなURLが発行され、サイトのサムネイル画像をAPIで取得できます。
https://api.thumbalizr.com/api/v1/embed/********/?url=https%3A//www.yahoo.co,jp/&width=300&size=page

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0