Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, bs4, webbrowser, time, json
- #konwesja stringów do "bez znaków polskich"
- #wave_obj = sa.WaveObject.from_wave_file("kaching.wav")
- print(' ')
- print(' ')
- linksList = []
- linksListOld = []
- zasieg = 100
- cena_max = 15000
- cena_min = 1000
- przedmiot = "mercedes"
- miasto = "krakow"
- def update_linksList():
- res = requests.get('https://www.olx.pl/tychy/q-' + przedmiot + '/?search%5Border%5D=created_at%3Adesc&search%5Bfilter_float_price%3Afrom%5D=' + str(cena_min) + '&search%5Bfilter_float_price%3Ato%5D=' + str(cena_max) + '&search%5Bdist%5D=' + str(zasieg))
- res.raise_for_status()
- noStarchSoup = bs4.BeautifulSoup(res.text, 'html.parser')
- type(noStarchSoup)
- linksList.clear()
- for link in noStarchSoup.find_all('a', class_ = 'marginright5 link linkWithHash detailsLink'):
- linksList.append(link.get('href'))
- linksListOld = linksList.copy()
- update_linksList()
- while True:
- if linksListOld != linksList :
- webbrowser.open(linksList[0])
- name = str(linksList[0])
- webbrowser.open(linksList[0])
- linksListOld = linksList.copy()
- print("nowa oferta!!!")
- elif linksListOld == linksList :
- update_linksList()
- print("nie znaleziono nowych ofert : (")
- else :
- break
- time.sleep(45)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement