21 lines
564 B
Python
21 lines
564 B
Python
|
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"))
|