Last active
November 23, 2018 19:09
-
-
Save bholota/bd455b27c751b36a569f81cf0aa53703 to your computer and use it in GitHub Desktop.
Quick search in AMW auction-less deals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import sys | |
from bs4 import BeautifulSoup | |
URL_AMW = "https://amw.com.pl/pl/uzbrojenie-i-sprzet-wojskowy/sprzet-wojskowy/sprzedaz-bezprzetargowa/wyniki" \ | |
"-wyszukiwania" | |
params = {"search": sys.argv[1]} | |
response = requests.get(URL_AMW, params=params) | |
content = BeautifulSoup(response.content, "html.parser") | |
# filter contents | |
shop_content = content.findAll('div', {"class": "article--auction__list__elem__box " | |
"article--auction__list__elem__box--name " | |
"article--auction__list__elem__box--vertical-middle"}) | |
items = [] | |
for single_shop in shop_content: | |
shop_items = [item.string for item in single_shop.contents if item.name == 'span'] | |
items += shop_items | |
for i, name in enumerate(items, 1): | |
print(" %d. %s" % (i, name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output: