File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import requests
2+ from bs4 import BeautifulSoup as bs
3+
4+ url = "https://s.pstatic.net/static/www/img/uit/sp_main_6f9b98.png"
5+ r = requests .get (url )
6+ f = open ("naver_main.png" , "wb" )
7+ f .write (r .content )
8+ f .close
Original file line number Diff line number Diff line change 1+ import requests
2+ from bs4 import BeautifulSoup as bs
3+ import os .path
4+
5+ url = "http://urll.kr"
6+ r = requests .get (url )
7+ html = r .text
8+ soup = bs (html , 'html.parser' )
9+
10+ imgs = soup .find_all ('img' )
11+ for i in imgs :
12+ # base_url = "http://urll.kr"
13+ f_path = i .get ("src" )
14+ img_url = f_path
15+
16+ r = requests .get (img_url )
17+ f_name = os .path .basename (f_path )
18+ print (f_name )
19+ try :
20+ with open ("images/" + f_name , "wb" ) as f :
21+ f .write (r .content )
22+ except :
23+ pass
24+
You can’t perform that action at this time.
0 commit comments