Skip to content

Instantly share code, notes, and snippets.

@bholota
Last active November 23, 2018 19:09
Show Gist options
  • Save bholota/bd455b27c751b36a569f81cf0aa53703 to your computer and use it in GitHub Desktop.
Save bholota/bd455b27c751b36a569f81cf0aa53703 to your computer and use it in GitHub Desktop.
Quick search in AMW auction-less deals
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))
@bholota
Copy link
Author

bholota commented Nov 23, 2018

Sample output:

python3 amw_search.py aparat
 1. Aparat do sztucznego oddechu z pompą
 2. Aparat telefoniczny polowy AP-82
 3. Aparat nurkowy P22/UAN-82
 4. Aparat nurkowy powietrzny p-22/uan-82
 5. APARAT FOTOGRAFICZNY
 6. Aparat telefoniczny polowy TAP-67

Process finished with exit code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment