Testing del scraping de la fuente de imágenes.

This commit is contained in:
basset 2020-06-14 18:33:05 +02:00
parent dd2538f1ea
commit 58c0f4897d
1 changed files with 20 additions and 0 deletions

20
app/pruebascraping.py Normal file
View File

@ -0,0 +1,20 @@
from bs4 import BeautifulSoup
import urllib.request
import re
def request_Flickr(keywords):
datos=urllib.request.urlopen("https://commons.wikimedia.org/w/index.php?search={keywords}&title=Special%3ASearch&go=Go&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1").read().decode()
return datos;
def scrap_Flickr(datos):
soup=BeautifulSoup(datos, features="lxml")
tag=soup.find("table", class_="searchResultImage")
images=tag.find_all("a", class_="image")
for image in images:
print(image["href"])
scrap_Flickr(request_Flickr("paris"))