Testing del scraping de la fuente de imágenes.
This commit is contained in:
parent
dd2538f1ea
commit
58c0f4897d
|
@ -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"))
|
Loading…
Reference in New Issue