Get the title of a given URL.

This technical problem deals with scraping the title from a given URL. An example input and output is provided.


Given a URL, return the title of the page.
Example input:
Example output:


This solution is in Python. Our A.I. can create solutions in multiple languages.
by kayakane
import requests
from bs4 import BeautifulSoup

def get_title(url):
    r = requests.get(url)
    soup = BeautifulSoup(r.text, 'html.parser')
    return soup.title.string


A.I. Evaluation of the Solution

This solution correctly imports the necessary libraries and defines the get_title function. This function takes in a url and returns the title of the page using BeautifulSoup. This is a good solution.

Evaluated at: 2022-11-11 08:16:02