-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrape2.py
More file actions
23 lines (21 loc) · 720 Bytes
/
Copy pathscrape2.py
File metadata and controls
23 lines (21 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#Updated on 6/11/2014
import requests
import urllib
from BeautifulSoup import BeautifulSoup
import os
#Outputs the entire html source code and prints it
url = 'http://www-rohan.sdsu.edu/~gawron/python_for_ss/course_core/book_draft/web/HTMLParser.html'
response = requests.get(url)
html = response.content
print html
raw_input("Press enter to jump to next")
os.system('clear')
soup = BeautifulSoup(html)
print soup.prettify()
raw_input("Press enter to jumo to next")
os.system('clear')
thisurl = 'http://www-rohan.sdsu.edu/~gawron/python_for_ss/course_core/book_draft/web/HTMLParser.html'
handle = urllib.urlopen(thisurl)
html_gunk = handle.read()
#print html_gunk
print html_gunk[:150] #prints the first 150 letter