Giter VIP home page Giter VIP logo

image_collectors's Introduction

image_collectors

画像検索APIを叩いて画像収集するやつです(スクレイピングではなく、正規の手順でAPIを叩きます)
BingとGoogleそれぞれのパターンがありますので、所属する宗教の方をお使いください。救われさえすればいいという無宗教の方はBingを強くおすすめします。

スクレイピングではなくAPIを使うため課金が発生しますが、アカウント設立時に貰える無料クーポンで実質無料みたいなもんです(クーポン利用期間制限はありますが)

それぞれの詳細は以下もご参照ください

実行環境

  • Python3

実行方法

API keyの設定

Bing or GoogleのAPI keyを事前に取得している前提です。
API keyは実行スクリプトとは別のファイルauthentication.iniに書き込み、configparseで読み出す形式になっています。

まず、bing_image_collector.pyなどがあるのと同じ階層でauthentication.iniファイルを作成します。

$ touch authentication.ini

作成したauthentication.iniに取得したAPI keyを以下のように書き込みます。BingとGoogleで必要なkeyだけ書けば大丈夫です(両方は必要ありません)。

[auth]
bing_api_key = xxxxxxxxxxxxxxxx
google_api_key = xxxxxxxxxxxxxxxxx
google_se_key = xxxxxxxxxxxxx

(注意!)文字列はシングルコートなどで囲わずそのまま書き込む

  • bing_api_key ・・・ Bing Image Search APIのkeyを指定します。API keyの取得方法の例はこちら
  • google_api_key ・・・ Google Custom Search APIのkeyを指定します。API keyの取得方法の例はこちら
  • google_se_key ・・・ Google Custom Engineのkeyを指定します。Google Custom Search APIを利用するには Search API用のkeyの他に、Custom Engineのkeyも必須となります。取得例はこちら

スクリプトの実行

Bing Image Search APIを利用する場合

$ python3 bing_image_collector.py

検索クエリーやパラメータなどの指定方法はQiitaにまとめました

Google Custom Search APIを利用する場合

$ python3 google_image_collector.py

検索クエリーやパラメータなどの指定方法はQiitaにまとめました

image_collectors's People

Contributors

bp-yuta-yoshida avatar ysdyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.