Nurislom Turaev Nurislom Turaev - 2 months ago 8
Python Question

Bot clicking to good offers

I often see good offers in special sale website, but it stays for 2-3 second. I want to write a bot that will collect information, analyse and buy if offer will be with lower price within one second. The site doesn't show real time data. So bot should refresh it every second.
What will you advice me? How to do it. I know python basics. Is it real to do it?
P.s. I do not need open sources or already done apps. I have own ideas, so the project should be mine.

Answer Source

What you want is called web scraping. Python is a really good language for that. There are three python librarys what people usually use. BeautifulSoup , Splinter and Scrapy. You should use pip to install theese librarys. You can find really good guides on the internet after you know what to look for.

Since you want to do more than just scraping. I advice you to get Selinium as well it's like a browser for python and you can interact with websites too(note: you don't need Selinium if you use splinter).

For instance here is a sample code which does a search on a webpage than saves the result to a variable:

from splinter import Browser                
with Browser() as browser: 
  browser.visit(url)
  browser.fill('textbox', 'your text here')
  browser.find_by_name('Submit').click()
  copied_text = browser.find_by_id('results')[0].text