This code is for getying links from html webpages, but I want to make it give me only the links with certain words.
For instance, only links that have this word in there urls: "www.mywebsite.com/word"
My code :
import httplib2
from BeautifulSoup import BeautifulSoup, SoupStrainer
http = httplib2.Http()
status, response = http.request('http://www.mywebsite.com')
for link in BeautifulSoup(response, parseOnlyThese=SoupStrainer('a')):
if link.has_key('href'):
print link['href']`