Project 1999

Go Back   Project 1999 > General Community > Rants and Flames

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 05-06-2012, 06:20 PM
El Culo El Culo is offline
Banned


Join Date: Jan 2012
Location: best bak da fuk up 'fo u get smak'd da fuk up~ nyoro~n h00t {o,o}
Posts: 127
Default

Quote:
Originally Posted by somnia [You must be logged in to view images. Log in or Register.]
Win. Can you include source code?
You need these two dependencies

http://python-requests.org
http://lxml.de/

PHP Code:
import requests
import lxml
.html

def find_images
(url):
    
root=lxml.html.parse(url).getroot()
    
root.make_links_absolute()
    
imgs = []
    for 
i in root.xpath('//div[contains(@id, "post_message")]//img'):
        
src i.attrib.get('src','')
        if 
'project1999' not in src:
            
imgs.append(i.attrib.get('src',''))
    return 
imgs

def main
():
    
nums=[x+for x in range(52)]
    
urls=['http://www.project1999.org/forums/showthread.php?t=37779&page=%d' %num for num in nums]

    
todownload = []
    for 
url in urls:
        for 
img in find_images(url):
            
todownload.append(img)

    
todownload = list(set(todownload)) #remove duplicates
    
print "downloading %d images" len(todownload)

    for 
counti in enumerate(todownload):
        try:
            print 
"%d downloading %s" % (counti)
            
open('imgs/%d' count'w').write(requests.get(i).content)
        
except:
            print 
"couldn't download %s" %i

if __name__ == '__main__':
    
main() 
http://wutdo.com/catimgs.zip
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:35 PM.


Everquest is a registered trademark of Daybreak Game Company LLC.
Project 1999 is not associated or affiliated in any way with Daybreak Game Company LLC.
Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.