Skip to content

Instantly share code, notes, and snippets.

@codesynapse
Created February 26, 2014 16:10
Show Gist options
  • Save codesynapse/9232634 to your computer and use it in GitHub Desktop.
Save codesynapse/9232634 to your computer and use it in GitHub Desktop.
How to extract URL from HTML Page using BeautifulSoup Python Library
from bs4 import BeautifulSoup
import requests
url= raw_input("Enter the search query :");
re=requests.get("http://"+url);
data = re.text
soup = BeautifulSoup(data)
for link in soup.find_all('a'):
print(link.get('href'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment