in Education by
I created a function that returns a list of urls given a specific companies name. I want to know search through this list of urls and find information on whether the company is owned by another company. Example: The company "Marketo" was acquired by Adobe. I want to return whether some company was acquired and by whom. Here is what I have so far: import requests from googlesearch import search from bs4 import BeautifulSoup as BS def get_url(company_name): url_list = [] for url in search(company_name, stop=10): url_list.append(url) return url_list test1 = get_url('Marketo') print(test1[7]) r = requests.get(test1[7]) html = r.text soup = BS(html, 'lxml') stuff = soup.find_all('a') print(stuff) I am new to web scraping and I have no idea how to really search through each URL (assuming I can) and find the information I seek. The value of test1 is the following list: ['https://www.marketo.com/', 'https://www.marketo.com/software/marketing-automation/', 'https://blog.marketo.com/', 'https://www.marketo.com/software/', 'https://www.marketo.com/company/', 'https://www.marketo.com/solutions/pricing/', 'https://www.marketo.com/solutions/', 'https://en.wikipedia.org/wiki/Marketo', 'https://www.linkedin.com/company/marketo', 'https://www.cmswire.com/digital-marketing/what-is-marketo-a-marketers-guide/'] JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I want to return whether some company was acquired and by whom You can scrape the crunchbase website to get this information.The downside is that you will be limiting your search to their site. To extend this you could perhaps include some other sites also. import requests from bs4 import BeautifulSoup import re while True: print() organization_name=input('Enter organization_name: ').strip().lower() crunchbase_url='https://www.crunchbase.com/organization/'+organization_name headers={ 'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36' } r=requests.get(crunchbase_url,headers=headers) if r.status_code == 404: print('This organization is not available\n') else: soup=BeautifulSoup(r.text,'html.parser') overview_h2=soup.find('h2',text=re.compile('Overview')) try: possible_acquired_by_span=overview_h2.find_next('span',class_='bigValueItemLabelOrData') if possible_acquired_by_span.text.strip() == 'Acquired by': acquired_by=possible_acquired_by_span.find_next('span',class_='bigValueItemLabelOrData').text.strip() else: acquired_by=False except Exception as e: acquired_by=False # uncomment below line if you want to see the error # print(e) if acquired_by: print('Acquired By: '+acquired_by+'\n') else: print('No acquisition information available\n') again=input('Do You Want To Continue? ').strip().lower() if again not in ['y','yes']: break Sample Output: Enter organization_name: Marketo Acquired By: Adobe Systems Do You Want To Continue? y Enter organization_name: Facebook No acquisition information available Do You Want To Continue? y Enter organization_name: FakeCompany This organization is not available Do You Want To Continue? n Notes Read the crunchbase Terms and seek their consent before you deploy this in any commercial projects. Also checkout the crunchbase api - I think this will be the legit way to go forward with what you are asking for.

Related questions

0 votes
    A………………….. is a special type of website that allows us to search for documents, websites over the internet Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    Write C program that use both recursive and non recursive functions to perform Linear search for a Key value in a given list. Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    In Python 2.7, I could get dictionary keys, values, or items as a list: >>> newdict = {1:0, 2:0, 3:0} ... to return a list in Python 3? Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    I have some data either in a list of lists or a list of tuples, like this: data = [[1,2,3], [4,5, ... store tuples or lists in my list? Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    How can someone get a index (1) in Python for a list ["qwe", "asd", "zxc"] and an item "asd" in the list? Select the correct answer from above options...
asked Jan 21, 2022 in Education by JackTerrance
0 votes
0 votes
    Write a program to accept string from user and search a given character from string without using find() function Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    Which will be the command to return information on query plans and execution statistics of the query plans? (1)explain() (2)stats() (3)All the Options (4)queryplan()...
asked May 23, 2021 in Technology by JackTerrance
0 votes
    You are working with this XML code snippet from the XML document cars.xml. You need to return the information about the cars ... D.doc("cars.xml")/cars/car[integer(year) > 2000]...
asked Mar 10, 2023 in Technology by JackTerrance
0 votes
    Which method is used to return information for all users associated with a database? (1)db.Users() (2)db.returnUsers() (3)db.getUsers()...
asked May 22, 2021 in Technology by JackTerrance
0 votes
    What will be the output of the following Python program? def foo(x): x[0] = ['def'] x[1] = ['abc'] return id(x) q = ['abc ... (id(q) == foo(q)) a) Error b) None c) False d) True...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python program? def foo(x): x[0] = ['def'] x[1] = ['abc'] return id(x) q = ['abc ... (id(q) == foo(q)) a) Error b) None c) False d) True...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    The following python program can work with ____ parameters. def f(x): def f1(*args, **kwargs): print("Sanfoundry") return x(*args, * ... ) return f1 a) any number of b) 0 c) 1 d) 2...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    I have a playbook that looks like the following. It is supposed to install python onto the remote machine ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
...