GithubHelp home page GithubHelp logo

qin2dim / istockphoto Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 2.0 2.87 MB

📸 Gracefully download dataset from iStockPhoto.

License: Apache License 2.0

Python 100.00%
dataset downloader istock istockphoto

istockphoto's Introduction

iStockPhoto Downloader

Gracefully download datasets from istock-photo.

Quickstart

  1. Download PyPI package

    pip install -U istockphoto
  2. Examples

    • Download images about panda phrase.
    import asyncio
    
    from istockphoto import Istock
    
    if __name__ == "__main__":
        istock = Istock.from_phrase("panda")
        asyncio.run(istock.mining())

    image

    • Similar mode
    import asyncio
    
    from istockphoto import Istock
    
    # phrase, image_id
    name2similar = [
        ("horse", "1280951754"),
        ("panda", "91781059"),
        ("cat", "1325997570")
    ]
    
    if __name__ == "__main__":
        for name, similar in name2similar:
            istock = Istock.from_phrase(name)
            istock.more_like_this(similar)
            asyncio.run(istock.mining())

    similar drawio

What's more

Home · QIN2DIM/istockphoto Wiki (github.com)

istockphoto's People

Contributors

qin2dim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

istockphoto's Issues

Can I only download low-resolution images?

After I run the program, the resolution of the downloaded images is 612. I don’t see the option to download other resolutions in the code, so I would like to ask if there is a way to download high-resolution images.

Cannot download images

Hi~
Thanks so much for your extraordinary work.
I face the same problem with the closed one.
I used the latest version, v0.1.2 and the demo_download code.
It shows:
image
The question is that I can access the website; the folder can be built, but no images can be downloaded.
Could you tell me what I should do to solve that?
Thanks again!

Help me

in VSC use this code:

from istockphoto import IstockPhotoDownloader
if __name__ == '__main__':
    IstockPhotoDownloader("house").mining()

Terminal Respose:

2023-02-17 12:40:27 | DEBUG - Init workers session
2023-02-17 12:40:27 | DEBUG - Container preload - phrase=house
2023-02-17 12:40:27 | DEBUG - Setup [iStock] - power=1 pages=1
2023-02-17 12:40:28 | DEBUG - Get image url - progress=[1/1] src=https://www.istockphoto.com/search/2/image?phrase=house&mediatype=photography&numberofpeople=none&orientations=square&page=1
Traceback (most recent call last):
  File "src\\gevent\\greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
  File "C:\Users\nicky\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\istockphoto\core.py", line 243, in _adaptor
    self.download_image(url)
  File "C:\Users\nicky\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\istockphoto\core.py", line 266, in download_image
    with open(fp, "wb") as file:
FileNotFoundError: [Errno 2] No such file or directory: '/1306490623/it/foto/blank-semplice-display-house-box-stand-isolato-su-sfondo-colore-pastello-rosa-minimo.jpg.jpg'
2023-02-17T11:40:28Z <Greenlet at 0x171bff80ca0: <bound method IstockPhotoDownloader._adaptor of <istockphoto.core.IstockPhotoDownloader object at 0x00000171BD207D60>>> failed with FileNotFoundError

2023-02-17 12:40:28 | SUCCESS - Task complete - offload=C:\Users\nicky\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\istockphoto\istock_dataset\house

I can generate the search link (with the defaults parameters) to the Istock site...
https://www.istockphoto.com/search/2/image?phrase=house&mediatype=photography&numberofpeople=none&orientations=square&page=1
but it doesn't generate any file for download.

I still haven't figured out if this script is used to download photos or to generate a search from the terminal to the website.
If it is possible to download could I understand how to do it?
Thank you.

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.