GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python_uitls/GetBQB/main.py at master · clwater/python_uitls Expand file tree/ Copy pathmain.pyMore file actions 85 lines (65 loc) · 1.97 KB / Copy pathmain.pyFile metadata and controls85 lines (65 loc) · 1.97 KB 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 # coding: utf-8 import os import re from time import sleep import requests webbase = 'http://www.youbiaoqing.com/hot/' def getbqb(img_url , imagename , index): # index = (int) (index / 10) # index = 'bqb/bqb' + str(index) index = 'bqb/bqb' try: os.mkdir(index) except Exception : pass basepath = str(index) + '/' img_name = basepath + imagename try: r = requests.get(img_url) with open(img_name, 'wb') as f: for chunk in r.iter_content(chunk_size=1024): f.write(chunk) except Exception : print('index: ' + index + ' img_url: ' + img_url + ' is bad url') def anasrc(alltext , index): alltext = alltext.replace('\t' , '') alltext = alltext.replace('\r' , '') alltext = alltext.replace('\n' , '') alltext = alltext.replace(' ' , '') print alltext # print('in anasrc') regu = 'blank"><img.*?>' imagelist = re.findall(regu , alltext , re.I) # imageurl = imageurl[0] for image in imagelist: imageurl = re.findall('http://img.*?\.jpg', image) try: imageurl = imageurl[0] # print 'imageurl: ' + imageurl name = re.findall('alt=".*?"' , image ) name = name[0] name = name.replace('alt="' , '') name = name.replace('"' , '') name = name.replace(' ' , '') name = name + '.jpg' if (u'可爱' in name or u'萌' in name) and u'tf' not in name: print name getbqb(imageurl , name , index) except Exception: pass #print('out anasrc') def main(): index = 0 #max 5866 # while index < 2: while True: print('is ' + str(index) + ' page') index = index + 1 weburl = webbase + str(index) print weburl r = requests.get(weburl) # print r.text anasrc(r.text , index) # sleep(5) if __name__ == '__main__': main() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |