Giter Club home page Giter Club logo

Comments (1)

ShimaaAhmed avatar ShimaaAhmed commented on August 26, 2024

Add this function to bing.py

def get_license(self, shorthand):
    if shorthand == "creative commons":
        return "+filterui:licenseType-Any"
    elif shorthand == "public":
        return "+filterui:license-L1"
    elif shorthand == "share":
        return "+filterui:license-L2_L3_L4_L5_L6_L7"
    elif shorthand == "modify,share":
        return "+filterui:license-L2_L3_L5_L6"
    elif shorthand == "commercial share":
        return "+filterui:license-L2_L3_L4"
    elif shorthand == "commercial modify,share":
        return "+filterui:license-L2_L3"
    else:
        print("[****************] Invalid license type. Defaulting to no license filter.[***********]\nThe available options are [creative commons, public, share, modify,share, commercial share, commercial modify,share]")
        return ""

and add the license to the request_url line in run(self) function:
request_url = 'https://www.bing.com/images/async?q=' + urllib.parse.quote_plus(self.query)
+ '&first=' + str(self.page_counter) + '&count=' + str(self.limit)
+ '&adlt=' + self.adult + '&qft=' + ('' if self.filter is None else self.get_filter(self.filter)) + ("" if self.license is None else self.get_license(self.license))

from bing_image_downloader.

Related Issues (20)

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.