Spaces:
Sleeping
Sleeping
Add extract image endpoint
Browse files
app.py
CHANGED
|
@@ -28,10 +28,10 @@ def extract_images():
|
|
| 28 |
try:
|
| 29 |
src=request.args.get("src")
|
| 30 |
response = requests.get(src)
|
| 31 |
-
soup = BeautifulSoup(response.
|
| 32 |
img_urls=[]
|
| 33 |
|
| 34 |
-
img_tags = soup.
|
| 35 |
for img_tag in img_tags:
|
| 36 |
img_url = img_tag['src']
|
| 37 |
img_urls.append(img_url)
|
|
|
|
| 28 |
try:
|
| 29 |
src=request.args.get("src")
|
| 30 |
response = requests.get(src)
|
| 31 |
+
soup = BeautifulSoup(response.content,'html.parser')
|
| 32 |
img_urls=[]
|
| 33 |
|
| 34 |
+
img_tags = soup.select('div img')
|
| 35 |
for img_tag in img_tags:
|
| 36 |
img_url = img_tag['src']
|
| 37 |
img_urls.append(img_url)
|