Advertisement
metalx1000

Marvel Comic Downloader Webkit

Jun 22nd, 2012
1,912
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import gtk, webkit, urllib2
  4.  
  5. x=100
  6.  
  7. def update_buttons(view, frame, resource, request, response):
  8.    global x
  9.    url=request.get_uri()
  10.    if "jpg?" in url:
  11.      print url
  12.      u = urllib2.urlopen(url)
  13.      file = open( str(x) + '.jpg','w')
  14.      file.write(u.read())
  15.      file.close()
  16.      x+=1
  17.  
  18. win = gtk.Window()
  19. win.connect('destroy', lambda w: gtk.main_quit())
  20. win.show()
  21.  
  22. box1 = gtk.HBox()
  23. win.add(box1)
  24.  
  25. web = webkit.WebView()
  26. web.connect("resource-request-starting", update_buttons)
  27. box1.pack_start(web)
  28.  
  29. web.open("https://marvel.com/digitalcomics/view.htm?iid=23569")
  30.  
  31. box1.show_all()
  32.  
  33. gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement