mirror of
https://github.com/kristoferssolo/School.git
synced 2026-03-22 00:26:35 +00:00
Final changes and commit
This commit is contained in:
@@ -8,37 +8,37 @@ url = "https://www.ikea.lv/"
|
||||
all_page = requests.get(url)
|
||||
|
||||
if all_page.status_code == 200:
|
||||
page = BeautifulSoup(all_page.content, 'html.parser')
|
||||
found = page.find_all(class_="itemBlock")
|
||||
page = BeautifulSoup(all_page.content, 'html.parser')
|
||||
found = page.find_all(class_="itemBlock")
|
||||
|
||||
info = []
|
||||
item_array = []
|
||||
for item in found:
|
||||
item = item.findChild("div").findChild(class_="card-body")
|
||||
info = []
|
||||
item_array = []
|
||||
for item in found:
|
||||
item = item.findChild("div").findChild(class_="card-body")
|
||||
|
||||
item_name = item.findChild(class_="itemName")
|
||||
item_name = item_name.findChild("div").findChild("h6")
|
||||
item_name = item.findChild(class_="itemName")
|
||||
item_name = item_name.findChild("div").findChild("h6")
|
||||
|
||||
item_array.append(item_name.string)
|
||||
item_array.append(item_name.string)
|
||||
|
||||
price = item.findChild(class_="itemPrice-wrapper")
|
||||
price = price.findChild("p").findChild("span")
|
||||
price = item.findChild(class_="itemPrice-wrapper")
|
||||
price = price.findChild("p").findChild("span")
|
||||
|
||||
try:
|
||||
item_array.append(price.attrs["data-price"])
|
||||
except:
|
||||
item_array.append(price.attrs["data-pricefamily"])
|
||||
try:
|
||||
item_array.append(price.attrs["data-price"])
|
||||
except:
|
||||
item_array.append(price.attrs["data-pricefamily"])
|
||||
|
||||
all_facts = []
|
||||
for facts in all_facts:
|
||||
if len(facts) == 1:
|
||||
all_facts.append(facts.string)
|
||||
else:
|
||||
atrasts = facts.findChildren("span")
|
||||
for i in atrasts:
|
||||
all_facts.append(i.string)
|
||||
all_facts = []
|
||||
for facts in all_facts:
|
||||
if len(facts) == 1:
|
||||
all_facts.append(facts.string)
|
||||
else:
|
||||
atrasts = facts.findChildren("span")
|
||||
for i in atrasts:
|
||||
all_facts.append(i.string)
|
||||
|
||||
item_array.append(all_facts)
|
||||
info.append(item_array)
|
||||
for ieraksts in info:
|
||||
print(ieraksts)
|
||||
item_array.append(all_facts)
|
||||
info.append(item_array)
|
||||
for ieraksts in info:
|
||||
print(ieraksts)
|
||||
|
||||
@@ -7,21 +7,22 @@ all_page = requests.get(url)
|
||||
# print(all_page)
|
||||
|
||||
if all_page.status_code == 200:
|
||||
print(":)")
|
||||
page = BeautifulSoup(all_page.content, 'html.parser')
|
||||
found = page.find(id="Etymology")
|
||||
# print(found)
|
||||
# print(found.constents)
|
||||
# print(found.string)
|
||||
found = page.find_all(class_="mw-headline")
|
||||
# print(found)
|
||||
found = page.find_all("li", class_="interlanguage-link")
|
||||
# print(found)
|
||||
found = page.find_all("a", class_="interlanguage-link-target")
|
||||
# print(found)
|
||||
for i in found:
|
||||
# print(i.prettify())
|
||||
if i.attrs["lang"] == "ru":
|
||||
print(f"{i.attrs['lang']} \t {i.attrs['title']} \n {i.attrs['href']}")
|
||||
print(":)")
|
||||
page = BeautifulSoup(all_page.content, 'html.parser')
|
||||
found = page.find(id="Etymology")
|
||||
# print(found)
|
||||
# print(found.constents)
|
||||
# print(found.string)
|
||||
found = page.find_all(class_="mw-headline")
|
||||
# print(found)
|
||||
found = page.find_all("li", class_="interlanguage-link")
|
||||
# print(found)
|
||||
found = page.find_all("a", class_="interlanguage-link-target")
|
||||
# print(found)
|
||||
for i in found:
|
||||
# print(i.prettify())
|
||||
if i.attrs["lang"] == "ru":
|
||||
print(
|
||||
f"{i.attrs['lang']} \t {i.attrs['title']} \n {i.attrs['href']}")
|
||||
else:
|
||||
print(":(")
|
||||
print(":(")
|
||||
|
||||
Reference in New Issue
Block a user