示例#1
0
def set_directory():
    print('Enter the directory to be set: ')
    data = input()
    chdir(data + ':\\')
    print('Enter name for the folder: ')
    data = input()
    create_directory(data)
    return True
示例#2
0
def set_directory():
    print("Enter the directory to be set: ")
    data = input()
    chdir(data + ":\\")
    print("Enter name for the folder: ")
    data = input()
    create_directory(data)
    return True
示例#3
0
def set_directory():
    print ('Enter the directory to be set: ')
    data = input()
    chdir(data + ':\\')
    print ('Enter name for the folder: ')
    data = input()
    create_directory(data)
    return True
示例#4
0
##############
def quit():
    print('''
-------------------------***Thank You For Using***-------------------------
        ''')
    return False


run = True

print('''
***********[First Creating Folder To Save Your Images}***********
    ''')

create_directory('Images')
DEFAULT_DIRECTORY = pardir + '\\Images'
chdir(DEFAULT_DIRECTORY)
count = 0
while run:
    print('''
-------------------------WELCOME-------------------------
    1. Search for image
    2. Download Wallpapers 1080p
    3. View Images in your directory
    4. Set directory
    5. Exit
-------------------------*******-------------------------
    ''')
    choice = input()
    try:
示例#5
0
##############
def quit():
    print("""
-------------------------***Thank You For Using***-------------------------
        """)
    return False


run = True

print("""
***********[First Creating Folder To Save Your Images}***********
    """)

create_directory("Images")
DEFAULT_DIRECTORY = pardir + "\\Images"
chdir(DEFAULT_DIRECTORY)
count = 0
while run:
    print("""
-------------------------WELCOME-------------------------
    1. Search for image
    2. Download Wallpapers 1080p
    3. View Images in your directory
    4. Set directory
    5. Exit
-------------------------*******-------------------------
    """)
    choice = input()
    try:
示例#6
0
##############
def quit():
    print ('''
-------------------------***Thank You For Using***-------------------------
        ''')
    return False


run = True

print ('''
***********[First Creating Folder To Save Your Images}***********
    ''')

create_directory('Images')
DEFAULT_DIRECTORY = pardir + '\\Images'
chdir(DEFAULT_DIRECTORY)
count = 0
while run:
    print ('''
-------------------------WELCOME-------------------------
    1. Search for image
    2. Download Wallpapers 1080p
    3. View Images in your directory
    4. Set directory
    5. Exit
-------------------------*******-------------------------
    ''')
    choice = input()
    try:
示例#7
0
def image_grabber(ch):

    # Download images from google images
    if ch == 1:
        print('Enter data to download Images: ')
        data = input()
        search_query = {'q': data}
        search = urlencode(search_query)
        print(search)
        g = GOOGLE_IMAGE + search
        request = Request(g, headers=usr_agent)
        r = urlopen(request).read()
        sew = BeautifulSoup(r, 'html.parser')
        images = []
        # print(sew.prettify())
        results = sew.findAll("div",{"class":"rg_meta"})
        for re in results:
            link, *Type = json.loads(re.text)["ou"] , json.loads(re.text)["ity"]
            images.append(link)
        counter = 0
        for re in images:
            rs = requests.get(re)
            with open('img' + str(counter) + '.jpg', 'wb') as file:
                file.write(rs.content)
                # urlretrieve(re, 'img' + str(count) + '.jpg')
                counter += 1
        return True

    elif ch == 2:
        cont = set()  # Stores the links of images
        temp = set()  # Refines the links to download images

        print('Enter data to download wallpapers: ')
        data = input()
        search_query = {'q': data}
        search = urlencode(search_query)
        print(search)
        g = WALLPAPERS_KRAFT + search
        request = Request(g, headers=usr_agent)
        r = urlopen(request).read()
        sew = BeautifulSoup(r, 'html.parser')
        count = 0
        for links in sew.find_all('a'):
            if 'wallpaperscraft.com/download' in links.get('href'):
                cont.add(links.get('href'))
        for re in cont:
            # print all valid links
            # print('https://wallpaperscraft.com/image/' + re[31:-10] + '_' + re[-9:] + '.jpg')
            temp.add('https://wallpaperscraft.com/image/' + re[31:-10] + '_' + re[-9:] + '.jpg')

        # Goes to Each link and downloads high resolution images

        for re in temp:
            rs = requests.get(re)
            with open('img' + str(count) + '.jpg', 'wb') as file:
                file.write(rs.content)
            # urlretrieve(re, 'img' + str(count) + '.jpg')
            count += 1

        return True

    elif ch == 3:
        for folders, subfolder, files in walk(curdir):
            for fold in folders:
                for folder in subfolder:
                    print(folder)
        return True

    elif ch == 4:
        print('Enter the directory to be set: ')
        data = input()
        chdir(data + ':\\')
        print('Enter name for the folder: ')
        data = input()
        create_directory(data)
        return True

    elif ch == 5:
        print(
                '''
-------------------------***Thank You For Using***-------------------------
            '''
            )
        return False
示例#8
0
def image_grabber(ch):

    # Download images from google images
    if ch == 1:
        print('Enter data to download Images: ')
        data = input()
        search_query = {'q': data}
        search = urlencode(search_query)
        print(search)
        g = GOOGLE_IMAGE + search
        request = Request(g, headers=usr_agent)
        r = urlopen(request).read()
        sew = BeautifulSoup(r, 'html.parser')
        images = []
        # print(sew.prettify())
        results = sew.findAll("div", {"class": "rg_meta"})
        for re in results:
            link, Type = json.loads(re.text)["ou"], json.loads(re.text)["ity"]
            images.append(link)
        counter = 0
        for re in images:
            rs = requests.get(re)
            with open('img' + str(counter) + '.jpg', 'wb') as file:
                file.write(rs.content)
                # urlretrieve(re, 'img' + str(count) + '.jpg')
                counter += 1
        return True

    elif ch == 2:
        cont = set()  # Stores the links of images
        temp = set()  # Refines the links to download images

        print('Enter data to download wallpapers: ')
        data = input()
        search_query = {'q': data}
        search = urlencode(search_query)
        print(search)
        g = WALLPAPERS_KRAFT + search
        request = Request(g, headers=usr_agent)
        r = urlopen(request).read()
        sew = BeautifulSoup(r, 'html.parser')
        count = 0
        for links in sew.find_all('a'):
            if 'wallpaperscraft.com/download' in links.get('href'):
                cont.add(links.get('href'))
        for re in cont:
            # print all valid links
            # print('https://wallpaperscraft.com/image/' + re[31:-10] + '_' + re[-9:] + '.jpg')
            temp.add('https://wallpaperscraft.com/image/' + re[31:-10] + '_' +
                     re[-9:] + '.jpg')

        # Goes to Each link and downloads high resolution images

        for re in temp:
            rs = requests.get(re)
            with open('img' + str(count) + '.jpg', 'wb') as file:
                file.write(rs.content)
            # urlretrieve(re, 'img' + str(count) + '.jpg')
            count += 1

        return True

    elif ch == 3:
        for folders, subfolder, files in walk(curdir):
            for folder in subfolder:
                print(folder)
        return True

    elif ch == 4:
        print('Enter the directory to be set: ')
        data = input()
        chdir(data + ':\\')
        print('Enter name for the folder: ')
        data = input()
        create_directory(data)
        return True

    elif ch == 5:
        print('''
-------------------------***Thank You For Using***-------------------------
            ''')
        return False