<jupyter_start><jupyter_text>Welcome to Celebrity Finder Notebook  Importing Library<jupyter_code>import pandas as pd
from bs4 import BeautifulSoup
from urllib.request import urlopen, Request, urlretrieve
from IPython.display import IFrame, display
from PIL import Image
from selenium import webdriver
import os<jupyter_output><empty_output><jupyter_text>Spelling Checker<jupyter_code>def spelling_checker(x):
    crt_inp=''
    search = '+'.join(x.split())
    url='https://www.google.com/search?q='+ search
    driver = webdriver.Chrome(executable_path=r'C:\Users\jpravijo\Desktop\Anaconda\chromedriver_win32 (3)\chromedriver.exe')
    driver.get(url)
    html = driver.page_source
    soup = BeautifulSoup(html,'lxml')
    driver.close()
    try:
        first = soup.find('div', id='taw')
        crt_inp=first.find('a', class_='gL9Hy').text
    except:
        crt_inp=x
    return crt_inp
print('enter the celebrity name to spell check')
spell_inp = input()
inp = spelling_checker(spell_inp)
if spell_inp == inp:
    print('\033[1m' + 'U have entered a proper spelling of a celebrity and we can continue with this')
else:
    print('\n' + 'The celebrity name close to your spelling is ' + '\033[1m' + inp + '\033[0m' + ' and we can continue with this')<jupyter_output>enter the celebrity name to spell check
<NAME>

The celebrity name close to your spelling is [1m<NAME>[0m and we can continue with this<jupyter_text>Celebrity Detail Finder Function<jupyter_code>def process_inp(x):
    temp=''
    for i in x.split():
        temp = temp + ' '+ i.capitalize()
    name = temp.lstrip()
    temp = '_'.join(name.split())
    return temp, name
inp, name = process_inp(inp)
def celebrity_func(inp, name):
    url='https://en.wikipedia.org/wiki/'+inp
    html=urlopen(url)
    soup=BeautifulSoup(html,'lxml')
    first = soup.find('div', id='mw-content-text')
    try:
        Description = first.find('div', class_='shortdescription nomobile noexcerpt noprint searchaux').text
    except:
        Description = 'Not Found'
    try:
        DOB = first.find('span', class_='bday').text
    except:
        DOB = 'Not Found'
    try:
        image_link = "https:" + first.find('a', class_='image').img['src']
    except:
        image_link = 'Not Found'
    
    #Birth_Place = first.find('span', class_='birthplace').text
    #Birth_Place = first.find('td', class_='birthplace').text
    #Birth_Place = first.find('div', class_='birthplace').text
    for y in ['div', 'span', 'td']: 
        try:
            Birth_Place = first.find(y, class_='birthplace').text
            Birth_Place = ' '.join(Birth_Place.split('\n'))
            Birth_Place = ' '.join(Birth_Place.split(' '))
            Birth_Place = ''.join(Birth_Place.split('[')[0])
            break
        except:
            Birth_Place = ''
    dic={'Name': name, 'Description': Description, 'DOB': DOB, 'Birth_Place':Birth_Place, 'Image_Link':image_link, 'URL':url}
    return dic
try:
    dic = celebrity_func(inp, name)
    df = pd.DataFrame(dic, index=['Index'])
    df.drop(['Image_Link'], axis=1, inplace=True)
except:
    print('This is not a celebrity\'s name ')
#To Download the picture from the link and save in the filepath
filepath = r"C:\Users\jpravijo\Desktop\Anaconda\Celebrities_Images\\" + inp +".png"
urlretrieve(dic['Image_Link'], filepath)

#To Display the downloaded picture
image = Image.open(filepath)
print('\033[1m' + 'Please confirm the celebrity with \'yes\' or \'no\' by running the next cell'.center(50))
image<jupyter_output>[1mPlease confirm the celebrity with 'yes' or 'no' by running the next cell<jupyter_text>Confirm the celebrity for details<jupyter_code>Confirmation = input('\033[1m' + 'Please confirm the celebrity with \'yes\' or \'no\' - '.center(50))
found = 100000
if Confirmation == 'yes':
    found = df.index[df['Name']==name]
    display(df.loc[found, :])
    print('\n'+'\033[1m' + 'For more details run additional details cell')
else:
    print('\n'+'\033[1m' + 'Sry!! Please check the spelling of the celebrity and try again')<jupyter_output>[1mPlease confirm the celebrity with 'yes' or 'no' -  yes<jupyter_text>Additional Details<jupyter_code>IFrame('https://en.wikipedia.org/wiki/'+ inp, width=950, height=800)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14399624765478425, 'fraction_numerical': 0.012898686679174483, 'mean_word_length': 3.9535423925667827, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '409176', 'license': 'MIT', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1447, 'n_words': 355, 'path': 'Celebrities Details Finder.ipynb', 'repo_name': 'JohnPravin97/Celebrity-Finder', 'size': '4281'}