I'm working with beautiful soup and am trying to grab the first tag on a page that has the attribute equal to a certain string.
For example:
<a> href="url" title="export" </a>
soup.select("a[title='export']")
find("a", {"title":"export"})
.get("href")
find()
What I've been trying to do is grab the href of the first that is found whose title is "export".
You're almost there. All you need to do is, once you've obtained the tag, you'll need to just index it to get the href. Here's a slightly more bulletproof version:
try:
url = soup.find('a', {title : 'export' })['href']
print(url)
except TypeError:
pass