All Projects → wolfhong → Python Pisces

wolfhong / Python Pisces

Licence: mit
A tools to search for and download images by keywords using search engines: google/baidu/yahoo/bing. 使用google等搜索引擎搜索关键词并下载图片

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Pisces

Xinahn Socket
一个开源,高隐私,自架自用的聚合搜索引擎。 https://xinahn.com
Stars: ✭ 77 (+28.33%)
Mutual labels:  google, baidu
Jsearch
jSearch(聚搜) 是一款专注内容的chrome搜索扩展,一次搜索聚合多平台内容。
Stars: ✭ 193 (+221.67%)
Mutual labels:  google, baidu
Cesium Map
Cesium 地图插件,用于添加国内各大地图厂商的地图🌎
Stars: ✭ 80 (+33.33%)
Mutual labels:  google, baidu
Image Downloader
Download images from Google, Bing, Baidu. 谷歌、百度、必应图片下载.
Stars: ✭ 1,173 (+1855%)
Mutual labels:  google, baidu
Translators
🌏🌍🌎Translators🌎🌍🌏 is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python. Translators是一个旨在用Python为个人和学生带来免费、多样、愉快翻译的库。
Stars: ✭ 295 (+391.67%)
Mutual labels:  google, baidu
Xiaoai
a tiny&smart AI & Repo for work for AI Survey百度云资源持续更新中,欢迎点赞star Min's blog 欢迎访问我的博客主页!(Welcome to my blog website !)https://liweimin1996.github.io/
Stars: ✭ 111 (+85%)
Mutual labels:  google, baidu
Ssssrv2rayclashtrojan
科学上网,ss, ssr, v2ray, trojan, clash, clashr,翻墙机场推荐
Stars: ✭ 186 (+210%)
Mutual labels:  google, baidu
Dc Sdk
DC-SDK 是基于 Cesium 进行二次开发的2、3D一体 WebGis 应用框架,该框架优化了 Cesium 的使用方式和增添了一些额外功能,旨在为开发者快速构建 WebGis 应用。🌎
Stars: ✭ 206 (+243.33%)
Mutual labels:  google, baidu
Alfred Web Search Suggest
Alfred search suggest workflow for various popular websites.
Stars: ✭ 249 (+315%)
Mutual labels:  google, baidu
Sitedorks
Search Google/Bing/Ecosia/DuckDuckGo/Yandex/Yahoo for a search term with a default set of websites, bug bounty programs or a custom collection.
Stars: ✭ 221 (+268.33%)
Mutual labels:  google, baidu
Mtrans
Multi-source Translation
Stars: ✭ 711 (+1085%)
Mutual labels:  google, baidu
Sou
简单搜索,一个简单的前端界面。用惯了各种导航首页,满屏幕尽是各种不厌其烦的广告和资讯;尝试自己写个自己的主页。
Stars: ✭ 628 (+946.67%)
Mutual labels:  google, baidu
Socialite
Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.
Stars: ✭ 1,026 (+1610%)
Mutual labels:  google, baidu
Google Measurement Php Client
PHP Client to send analytics data over the Google Measurement Protocol to Google Analytics
Stars: ✭ 52 (-13.33%)
Mutual labels:  google
Netcore Postgres Oauth Boiler
A basic .NET Core website boilerplate using PostgreSQL for storage, Adminer for db management, Let's Encrypt for SSL certificates and NGINX for routing.
Stars: ✭ 57 (-5%)
Mutual labels:  google
Gphotos Sync
Google Photos and Albums backup with Google Photos Library API
Stars: ✭ 1,066 (+1676.67%)
Mutual labels:  google
Keyring
Keyring is an authentication framework for WordPress. It comes with definitions for a variety of HTTP Basic, OAuth1 and OAuth2 web services. Use it as a common foundation for working with other web services from within WordPress code.
Stars: ✭ 52 (-13.33%)
Mutual labels:  google
Google Chinese Handwriting Ime
Written in Electron for Linux.
Stars: ✭ 58 (-3.33%)
Mutual labels:  google
Laravel Google Ads
Google Ads API for Laravel
Stars: ✭ 56 (-6.67%)
Mutual labels:  google
L Passport
Koa middleware and api sdk for wechat oauth, qq oauth, baidu oauth and weibo oauth
Stars: ✭ 52 (-13.33%)
Mutual labels:  baidu

PyPI

Why use pisces?

This project origins from the needs of image dataset for algorithm training.

Image search engines, such as Google, are quite powerful now. They are enough if we could use them. However, they didn't provide convenient API for us.

Pisces uses selenuim, which can work with chromedriver to download the images we need. Pisces supports these search engines: google, yahoo, bing, baidu(china) and more mainstream engines in the future.

Why use pisces?(Chinese)

本项目起源于算法训练需要图像数据集的需求.

现有的图片搜索引擎,比如Google,相当强大了,能够利用起来,已经可以满足我们的需求. 然而,这些网站并没有提供方便的API让我们得到图片链接.

Pisces使用了selenuim, 可调用主流的浏览器下载搜索到的图片. Pisces还整合了其他的搜索引擎的搜索结果:google/yahoo/bing/百度.

Installation

First, make sure you have chrome browser installed on your computer. If not, selenium gives "selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary".

If you're working on a server without interface (for example, CentOS), you can also follow the steps below to install it:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum -y localinstall google-chrome-stable_current_x86_64.rpm

Use pip:

pip install python-pisces

From source code:

git clone https://github.com/wolfhong/python-pisces.git
cd python-pisces

pip install -r requirements.txt
export PYTHONPATH=./
python scripts/update_chromedriver.py  # download newest chromedriver according to platform
python setup.py install

In addition to chrome, you can also use firefox. However, you need to do extra settings for firefox. You have to download geckodriver and put it into your $PATH, which helps selenium interacting with firefox browser.

Pisces uses chrome as the default browser. You needn't download chromedriver youself because Pisces has built-in ones.

Pisces first finds chromedriver (for Chrome) or geckodriver (for Firefox) in pisces/tools/ in its package. If not, then finds it in $PATH.

Console Command

Once you have installed Pisces, you can easily use it to search for and download images by keywords:

$ pisces -e google -w 8 -n 500 fire "kitchen fire" -o ./output

The above command will start up chromedriver and then google "fire" and "kitchen fire" with its image search engine, download images with 8 threads parallelly and then restore these images in "./output" directory.

If you're in China, you're recommended to use -e baidu instand of -e google(default), because of some network problems. (在中国由于一些网络原因,推荐使用参数-e baidu,而不是默认的-e google)

image

Use pisces -h to show the usage:

    usage: command.py [-h] [-q] [--display] [-e ENGINE] [-w WORKERS] [-n NUMBER]
                  [-o OUTPUT_DIR] [-v]
                  [keywords [keywords ...]]

    Use keywords to search for and download images.

    positional arguments:
      keywords              keywords to search for images

    optional arguments:
      -h, --help            show this help message and exit
      -q, --quiet           quiet (no output)
      --display             start up browser with a graphical display, default to no
      -e ENGINE, --engine ENGINE
                            the image search engine you want to use, default to
                            google. select within [google, bing, yahoo, baidu]
      -b BROWSER, --browser BROWSER
                            the browser you have installed, default to chrome.
                            select within [chrome, firefox]
      -w WORKERS, --workers WORKERS
                            the number of threads when downloading images, default
                            to cpu core count
      -n NUMBER, --number NUMBER
                            the max number of images you want to download, default
                            to 100
      -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                            destination to store downloaded images, default to
                            ./output
      -v, --version         print the version and exit

Pisces can work on these platforms: windows, linux, mac, and it had beed tested. If not, you're welcome to file an issue.

More examples:

    $ pisces "kitchen fire" "forest fire"
    $ pisces -n500 "厨房火灾" "森林火灾"
    $ pisces -e baidu -n500 -o path-to-output 火灾 水灾

Code Example

Pisces can also be included in your projects:

    from pisces import Pisces

    # recommended to use `with`:
    with Pisces(quiet=False, headless=False) as client:
        output_dir = './output_water/'
        client.download_by_word('water', output_dir, engine='google', image_count=20)

    # or call `close()` handly:
    client = Pisces(quiet=False, headless=True, workers=4, browser='chrome')
    output_dir = './output_fire/'
    client.download_by_word('fire', output_dir, engine='baidu', image_count=20)
    client.close()

Tips

  • The code uses selenuim. More info to see ReadTheDocs
  • If you're in China, you're recommended to use -e baidu instand of -e google(default), because of some network problems.

About

Pisces is just a tools to search for and download images by keywords, using image search engine such as google, bing, baidu, etc. I hope it could help you in somewhere.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].