-
Notifications
You must be signed in to change notification settings - Fork 0
/
GhostDemo2.py
32 lines (30 loc) · 869 Bytes
/
GhostDemo2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from ghost import Ghost
def getCartoonUrl(self, url):
if url is None:
return false
#todo many decide about url
ghost = Ghost()
#open webkit
print url
ghost.open(url)
#exceute javascript and get what you want
result, resources = ghost.evaluate("document.getElementById('cp_image').getAttribute('src');")
del resources
return result
def getCartoonUrl(self, url):
if url is None:
return false
#todo many decide about url
ghost = Ghost()
#open webkit
ghost.open(url)
#exceute javascript and get what you want
result, resources = ghost.evaluate("document.getElementById('cp_image').getAttribute('src');")
del resources
return result
if __name__ == "__main__":
url = 'http://www.dm5.com/m136836-p3/'
result = None
fetcher = FetcherCartoon(url)
result = fetcher.getCartoonUrl(url)
print result