网站菜单 |
日记 - 爬虫
打 开 A P P 37 38 #打 开 ⾸ ⻚ 39 def main1(): 打 开 C S D N A P P 40 web='http://www.ivsky.com/tupian/' 41 html=openURL(web) 42 for link,titleC o p iny r i g h filterHTML(html):t © 1 9 9 9 - 2 0 2 0 , C S D N . N E T , A #link_re.findall(html):l l R i g h t s R e s e r v e d 43 #建 ⽴ ⽂ 件 夹 并 跳 转 44 print(title) 45 path=os.path.join(base_path,title) 46 if not os.path.isdir(path): 47 os.makedirs(path) 48 #进 ⼊ ⼦ ⻚ ⾯ 提 取 原 图 49 print('⼦ ⻚ ⾯ :',link) 50 sub_html=openURL(link) 51 for link,title in filterHTML(sub_html): 52 #再 次 进 ⼊ ⼦ ⻚ ⾯ 53 print('⼆ 次 ⼦ ⻚ ⾯ :',link) 54 html=openURL(link) 55 pic_url,pic_name=search_pic(html) 56 57 #保 存 图 ⽚ 58 try: 59 urllib.request.urlretrieve(pic_url,os.path.join(path,pic_na 60 except: 61 print('保 存 失 败 ') 62 63 def searchHTML(html): 64 result=[] 热 ⻔ 频 道 65 ![]() ![]() 评论: (1) |