Change: project dir structure
This commit is contained in:
25
beautifulsoup/main.py
Normal file
25
beautifulsoup/main.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from urllib.request import urlopen, Request
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import re
|
||||||
|
|
||||||
|
URL = "https://www.vinissimus.com/es/vinos/tinto/?cursor=0"
|
||||||
|
|
||||||
|
def main():
|
||||||
|
req = Request(
|
||||||
|
URL,
|
||||||
|
headers={
|
||||||
|
"User-Agent": "Mozilla/5.0 (compatible; Konqueror/3.5.8; Linux)"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
doc = BeautifulSoup(
|
||||||
|
urlopen(req),
|
||||||
|
"lxml"
|
||||||
|
)
|
||||||
|
|
||||||
|
for child in doc.find_all("div", class_="list large"):
|
||||||
|
name = child.find("h2", class_=["title"])
|
||||||
|
print(name)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user