Skip to content

Instantly share code, notes, and snippets.

@El-Coder
Forked from danlamanna/gist:b3c783f16bbdd663c5ac
Last active August 14, 2018 00:43
Show Gist options
  • Select an option

  • Save El-Coder/51542253c55a437bafef to your computer and use it in GitHub Desktop.

Select an option

Save El-Coder/51542253c55a437bafef to your computer and use it in GitHub Desktop.
import urllib, sys
from bs4 import BeautifulSoup
page = urllib.urlopen("https://ualbanydining.com/dining-choices/resident/indian.html")
soup = BeautifulSoup(page.read())
links = soup.select("#accordion_4736 ul li a")
if not links:
print "Couldn't find link.."
sys.exit(1)
else:
print links[0].attrs["href"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment