Fix this file so that it scrapes the web properly:
# python3 main.py to execute terminal
# version: 1.0 Feb 08 2024, operators up to date: April 25, 2023
import sys
from bs4 import BeautifulSoup as bs4
import requests
import webbrowser
from datetime import datetime
import bs4

chrome_path = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"  
webbrowser.register('chrome', None, webbrowser.BackgroundBrowser(chrome_path))
url = "https://google.com/search?q="
query_result = requests.get(url)
soup = bs4.BeautifulSoup(query_result.text, "html.parser")
headings = soup.find_all('h3', class_ = "LC20lb MBeuO DKV0Md")
description = soup.find_all('span')
definitions = soup.find_all('div', class_ = "PZPZlf")

# asking for query
print("Hello there! \nInput a query for enhanced search:")
object = input("")
print("\nConfirm: " + "'" + object + "'" + "? (y/n)")
object2 = input("")

def parser_change():
    soup = bs4.BeautifulSoup(query_result.text, "lxml")
    print("correct parser change function: query for each function")
    sys.exit()
#1    
def normal_search():
    query = f"'{object}'"
    webbrowser.open_new_tab(url + query)
    #something gets fucked up here: maybe its requests or something BUT
    # CODE DOESN'T KNOW WHERE TO FIND THE HEADINGS
    # DISCONNECT BETWEEN HEADINGS AND THE LINK SEARCHED UP
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        heading.prettify()
        print(heading)
        description.strip()
        description.prettify()
        print(description)
    print(f"\nScrape on '{object}' complete")
    #DOESNT WORK
    #changing the parser to lxml if html parser doesn't work
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#28
def recent_search():
    recent_year = datetime.now().year - 1
    query = object + " after:" + str(recent_year)
    webbrowser.open_new_tab(url + query)
    
    for heading in headings:
        print('\nFetching: heading(s), description(s)')
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    #changing the parser to lxml if html parser doesn't work
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#2    
def add_or():
    print(f"Add 'or' query to '{object}' below:")
    query_added = input("")
    query = object + " | " + query_added
    webbrowser.open_new_tab(url + query)
    
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' | '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' | '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#3
def add_query():
    print(f"Add 'AND' query to '{object}' below:")
    query_added = input("")
    query = object + " AND " + query_added
    webbrowser.open_new_tab(url + query)
    
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' AND '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' AND '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#4
def exclude_query():
    print(f"Exclude a query from '{object}'?")
    query_added = input("")
    query = object + " -" + query_added
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' -'{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' -'{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#5       
def wildcard():
    print(f"Add wilcard query to: '{object}'")
    query_added = input("")
    query = object + " * " + query_added
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' * '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' * '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#27
def pemdas():
    print(f"Add higher hierarchy query to '{object}':")
    query_added = input("")
    query = f"({query_added})" " " + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{query}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{query}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#26
def pemdas_and():
    print(f"Add higher hierarchy query to '{object}' before 'AND' operator:")
    query_added = input("")
    print(f"Add second hierarchy query to '{object}' after 'AND' operator:")
    query_added2 = input("")
    #query = f"({query_added} AND {query_added2}) + {object}"
    query = "(" + query_added + " AND " + query_added2 + ") " + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{query}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{query}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#25
def pemdas_or():
    print(f"Add higher hierarchy query to '{object}' before 'OR' operator:")
    query_added = input("")
    print(f"Add second hierarchy query to '{object}' after 'OR' operator:")
    query_added2 = input("")
    #query = f"({query_added} AND {query_added2}) + {object}"
    query = "(" + query_added + " OR " + query_added2 + ") " + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{query}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{query}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#6
def define():
    query = 'define:' + object
    webbrowser.open_new_tab(url + query)
    for definition in definitions:
        definition.strip()
        print(definition)
    print(f"\nScrape on '{query}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#7
def cache():
    print(f"Find most recent cache of a webpage: Enter full url:")
    cache = input("")
    query = 'cache:' + cache
    webbrowser.open_new_tab(url + query)
    print(f"landed on '{cache}'")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{query}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#8
def filetype():
    print(f"Add filetype to '{object}'")
    query_added = input("")
    query = object + " filetype:" + query_added
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#9
def site_specify():
    print(f"Add site to specify to '{object}'")
    query_added = input("")
    query = object + " site:" + query_added
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#10
def related_sites():
    print(f"Add related site (url):")
    query_added = input("")
    query = object + " related:" + query_added
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#11
def in_title():
    print(f"Searching for pages with '{object}' in title")
    query = "intitle:" + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{query}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{query}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#12
def all_in_title():
    print(f"Enter more terms to add to '{object}'")
    query_added = input("")
    query = "allintitle:" + object + " "+ query_added
    print('Your query will look like this: ' + query)
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#13
def in_url():
    print(f"Searching for '{object}' in url")
    query = "inurl:" + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{query}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{query}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#14
def all_in_url():
    print(f"Enter more terms to add to '{object}'")
    query_added = input("")
    query = "allinurl:" + object + query_added
    print('Your query will look like this: ' + query)
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#15
def in_text():
    print(f"Searching for '{object}' in pages")
    query = "intext:" + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{query}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{query}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#16
def all_in_text():
    print(f"Enter more terms to add to '{object}'")
    query_added = input("")
    query = "allintext:" + object + " " + query_added
    print('Your query will look like this: ' + query)
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' '{query_added}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' '{query_added}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#17
def weather():
    print("Enter location:")
    loc = input("")
    query = "weather:" + loc
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#18 TEST
def stocks():
    print("Enter ticker, ensure accuracy:")
    tkr = input("")
    query = "stocks:" + tkr
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#19 TEST
def map():
    print("Enter location, ensure accuracy:")
    loc = input("")
    query = "map:" + loc
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{loc}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{loc}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#20 TEST
def movie():
    print(f"Searching for movie information on '{object}'")
    query = "movie:" + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#21 TEST unit converter
def In():
    print("Enter primary unit (convert from):")
    pri_uni = input("")
    print("Secondary unit (convert to)")
    sec_uni = input("")
    query = pri_uni + " in " + sec_uni
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{pri_uni}' and '{sec_uni}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{pri_uni}' and '{sec_uni}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#22 TEST
def source_segregate():
    print("Enter source to constrict search by:")
    src = input("")
    query = object + " source:" + src
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#23 TEST
def before():
    print("Enter date to search before (Y-M-D), Ex: 2001-09-29")
    date = input("")
    query = object + "before:" + date
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#24 TEST
def after():
    print("Enter date to search after (Y-M-D), Ex: 2001-09-29")
    date = input("")
    query = object + "after:" + date
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
# ------------- unreliable 50/50 operators
#29 TEST
def range():
    print(f"Add minimum range constraint on '{object}', Ex: $10..#")
    max = input("")
    print(f"Add maximum range constraint on '{object}', Ex: #..$50")
    min = input("")
    query = object + " " + max + ".." + min
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#30 TEST
def in_anchor():
    print(f"Search for pages with backlinks containing '{object}'anchor text")
    query = "inanchor:" + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#31
def all_in_anchor():
    print(f"Add another query to '{object}' to anchor text:")
    query_added = input("")
    query = "inanchor:" + object + query_added
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#32 TEST
def around():
    print("Enter second query:")
    query_added = input("")
    print("Within how many words (number):")
    num = input("")
    query = object + "AROUND(" + num + ")" + query_added
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#33 TEST
def loc():
    print(f"Specify an area for '{object}'")
    loc = input("")
    query = "loc:" + loc + " " + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()
#34 TEST
def location():
    print("Add location to search google news with:")
    loc = input("")
    query = "location:" + loc + " " + object
    webbrowser.open_new_tab(url + query)
    for heading in headings:
        print("\nFetching: heading(s), description(s)")
        heading.strip()
        print(heading)
        description.strip()
        print(description)
    print(f"\nScrape on '{object}' complete")
    parser_check = input("\nUnsatisfied with return, change parser to 'lxml'? (y/n)\n")
    print("Add spaces around operators for more results (works sometimes)")
    if (parser_check == "y"):
        parser_change()
        print(f"\nScrape on '{object}' complete")
    elif (parser_check == "n"):
        print('terminating program')
        sys.exit()

# if query is incorrect program ends
# QUERY SELECTION
if(object2 == "y"):
    # asking if user wants a recent search, then printing in terminal
    print(f"\n*Normal search on '{object}' (1)\n   Adds:\n   None ---> meta tag   Ex: 'steve jobs'")
    print(f"\n*Add 'or' query to '{object}' (2)\n   Adds:\n   '|' OR operator ---> meta tag   Ex: jobs OR internships")
    print(f"\n*Add 'and' query to '{object}' (3)\n   Adds:\n   'AND' operator ---> meta tag   Ex: jobs AND internships")
    print(f"\n*Add: 'search exclusion' query to '{object}' (4)\n   Adds:\n   '-' operator ---> meta tag   Ex: internships -bayer [Search for results that don't mention a word or phrase]")
    print(f"\n*Add: 'wildcard' query to '{object}' (5)\n   Adds:\n   '*' operator ---> meta tag   Ex: jobs * internships")
    print(f"\n*Define '{object}' (6)\n   Adds:\n   'define' operator ---> meta tag(s)")
    print(f"\n*Find most recent cache on website (7)\n   Adds: 'cache:' ---> meta tag Ex: cache:bayer.com")
    print(f"\n*Search for filetype on '{object}' (8)\n   Adds: 'filetype:' ---> meta tag Ex: bayer filetype:pdf")
    print(f"\n*Add site specificty on '{object}' (9)\n   Adds: 'site:' ---> meta tag Ex: site: bayer.com")
    print(f"\n*Search for related sites to a given domain: (10)\n   Adds: 'related:' ---> meta tag Ex: related:bayer.com")
    print(f"\n*Search for '{object}' in title tags MUST ONLY BE 1 WORD (11)\n   Adds: 'intitle:' ---> meta tag Ex: intitle:'{object}'")
    print(f"\n*Search for pages with multiple words in the title tag. Add to '{object}', ensure proper spacing: (12)\n   Adds: 'allintitle' ---> meta tag Ex: allintitle: '{object}' + '{object}'")
    print(f"\n*Search for pages with '{object}' in URL (13)\n   Adds: 'inurl:' ---> meta tag) Ex: inurl:bayer")
    print(f"\n*Search for pages with multiple words in URL. Add to '{object}', ensure proper spacing (14)\n   Adds: 'allinurl' ---> meta tag Ex: allinurl: '{object}' + '{object}'")
    print(f"\n*Search for '{object}' in content of webpages (general) (15)\n   Adds: 'intext:' ---> meta tag Ex: intext:'{object}'")
    print(f"\n*Search for pages with multiple words in TEXT. Add to '{object}', ensure proper spacing (16)\n   Adds: 'allintext:' ---> meta tag Ex: allintext: '{object}' + '{object}'")
    print(f"\n*Search for weather in specified location (17)\n   Adds: 'weather:' ---> meta tag Ex: weather:Miami Beach")
    print(f"\n*Search for stock information on a ticker (18)\n   Adds: 'stocks:' ---> meta tag Ex: stocks:BMW.DE")
    print(f"\n*Pull up map on location, ensure proper spacing (19)\n   Adds: 'map:' ---> meta tag Ex: map:silcon valley")
    print(f"\n*Search for movie information on '{object}' (20)\n   Adds: 'movie:' ---> meta tag Ex: movie:oppenheimer")
    print(f"\n*Convert one unit to another, deprecates '{object}' (21)\n   Adds: 'in' ---> meta tag Ex: $400 in GBP")
    print(f"\n*Search for results from a specific source in Google News on '{object}' (22)\n   Adds: 'source:' ---> meta tag Ex: bayer source: washington post")
    print(f"\n*Search for results on '{object}' before a particular date (Y-M-D) (23)\n   Adds: 'before' ---> meta tag Ex: bayer before:2001-07-03")
    print(f"\n*Search for results on '{object}' after a particular date (Y-M-D) (24)\n   Adds: 'after' ---> meta tag Ex: bayer before:2001-07-03")
    print(f"\n*Add superior 'OR' hierarchal query on '{object}' (25)\n   Adds:\n   '(x OR x)' ---> meta tag [parenthesis priooritized] Ex: (jobs OR internships) bayer")
    print(f"\n*Add superior 'AND' hierarchal query on '{object}' (26)\n   Adds:\n   '(x AND x)' ---> meta tag [parentheses prioritized] Ex: (jobs AND internships) bayer")
    print(f"\n*Add superior hierarchal query on '{object}' (27)\n   Adds:\n   '()' ---> meta tag Ex: (superior query) '{object}'")
    print(f"\n*Recent scrape on '{object}' (28)\n   Adds:\n   'after:currentyear - 1'  ---> meta tag")
    # 50/50 operators
    print("--------------------------\nUnreliable 50/50 operators:")
    print(f"\n*Search between a range of numbers on '{object}', add signs if necessary. (29)\n   Adds: '#..#' ---> meta tag Ex: '{object}' ")
    print(f"\n*Search for pages with backlinks with '{object}' anchor text (30)\n   Adds: 'inanchor: ---> meta tag Ex: inanchor:'{object}'")
    print(f"\n*Search for pages with backlinks with '{object}' and multiple words in their anchor text (31)\n   Adds: 'allinanchor:' ---> meta tag Ex: allinanchor:'{object}' + '{object}')")
    print(f"\n*Search for pages with two queries (query1 = '{object}') within X words of one another (32\n   Adds: 'AROUND' ---> meta tag Ex: bayer AROUND(3) internship)")
    print(f"\n*Find results from a given area, ensure proper spacing (33)\n   Adds: 'loc:' ---> meta tag Ex: loc: 'miami beach' '{object}'")
    print(f"\n*Find news from a certain location for '{object}' in Google News (34)\n   Adds: 'location:' ---> meta tag Ex: location:'miami beach' '{object}'")

elif(object2 != "y"):
    print("\nending program, restart query if desired")
    sys.exit()  
chooseMode = input("")

if(chooseMode == "1"):
    normal_search()
elif(chooseMode == "2"):
    add_or()
elif(chooseMode == "3"):
    add_query()
elif(chooseMode == "4"):
    exclude_query()
elif(chooseMode == "5"):
    wildcard()
elif(chooseMode == "6"):
    define()
elif(chooseMode == "7"):
    cache()
elif(chooseMode == "8"):
    filetype()
elif(chooseMode == "9"):
    site_specify()
elif(chooseMode == "10"):
    related_sites()
elif(chooseMode == "11"):
    in_title()
elif(chooseMode == "12"):
    all_in_title()
elif(chooseMode == "13"):
    in_url()
elif(chooseMode == "14"):
    all_in_url()
elif(chooseMode == "15"):
    in_text()
elif(chooseMode == "16"):
    all_in_text()
elif(chooseMode == "17"):
    weather()
elif(chooseMode == "18"):
    stocks()
elif(chooseMode == "19"):
    map()
elif(chooseMode == "20"):
    movie()
elif(chooseMode == "21"):
    In()
elif(chooseMode == "22"):
    source_segregate()
elif(chooseMode == "23"):
    before()
elif(chooseMode == "24"):
    after()
elif(chooseMode == "25"):
    pemdas_or()
elif(chooseMode == "26"):
    pemdas_and()
elif(chooseMode == "27"):
    pemdas()
elif(chooseMode == "28"):       
    recent_search()
# unreliable 50/50 operators
elif(chooseMode == "29"):
    range()
elif(chooseMode == "30"):
    in_anchor()
elif(chooseMode == "31"):
    all_in_anchor()
elif(chooseMode == "32"):
    around()
elif(chooseMode == "33"):
    loc()
elif(chooseMode == "34"):
    location()
#checking to see if input = correct, else terminate
numbers = list(range(1,  35))
if chooseMode not in numbers:
    print("\nincorrect input, terminating program")
    sys.exit()