I am struggling to scrape the correct URL with Beautifulsoup

Viewed 42

I am writing a web scraper and am struggling to get the href link from a web page. The URL is https://vcnewsdaily.com/Tessera%20Therapeutics/venture-funding.php I am trying to get this href link: https://www.tesseratherapeutics.com from the below section of the website

<a class="text-border-botton-color " target="_blank" href="https://www.tesseratherapeutics.com/">https://www.tesseratherapeutics.com/</a>

Here is my code:

from cgi import print_directory
import pandas as pd
import os
import requests
from bs4 import BeautifulSoup
import re

URL = "https://vcnewsdaily.com/Tessera%20Therapeutics/venture-funding.php"
page = requests.get(URL)
soup = BeautifulSoup(page.text, "html.parser")
links = []

for link in soup.findAll(class_="text-border-botton-color "):
    links.append(link.get("href"))
print(links)

When I run my code, I get this:

[]

Can someone help me get the correct href link?

Thanks!

1 Answers

@ggorlen stated Typo: "text-border-botton-color" not "text-border-botton-color " meaning you have to remove extra space that exists after color.

from cgi import print_directory
import pandas as pd
import os
import requests
from bs4 import BeautifulSoup
import re

URL = "https://vcnewsdaily.com/Tessera%20Therapeutics/venture-funding.php"
page = requests.get(URL)
soup = BeautifulSoup(page.text, "html.parser")
links = []

for link in soup.findAll(class_="text-border-botton-color"):
    links.append(link.get("href"))
print(links)

Output:

['https://www.tesseratherapeutics.com/']
Related