| 1 |
ninoborges |
8 |
## URL_Grab.py
|
| 2 |
|
|
## This is a program that I'm creating for Zope that will grab and return parts of websites.
|
| 3 |
|
|
## It will take 3 arguments ( siteUrl, startTag, endTag) and return HTML.
|
| 4 |
|
|
## EBorges
|
| 5 |
|
|
## 06.28.03
|
| 6 |
|
|
|
| 7 |
|
|
from urllib import urlopen
|
| 8 |
|
|
|
| 9 |
|
|
def GrabUrl(siteUrl, startTag, endTag):
|
| 10 |
|
|
doc = urlopen(siteUrl).read()
|
| 11 |
|
|
doc = doc.split(startTag)
|
| 12 |
|
|
doc = doc[1].split(endTag)
|
| 13 |
|
|
return doc[0]
|
| 14 |
|
|
|
| 15 |
|
|
if __name__ == '__main__':
|
| 16 |
|
|
#chop = GrabUrl('http://dictionary.reference.com/wordoftheday/', '<!-- content -->', '<!-- End content -->')
|
| 17 |
|
|
chop = GrabUrl('http://dictionary.reference.com/wordoftheday/', 'content', 'End content')
|
| 18 |
|
|
print chop |