Y
Y
Yurii Abraham2021-08-09 13:29:24
Python
Yurii Abraham, 2021-08-09 13:29:24

How to run a Telegram bot on a server if it works with a browser?

I wrote an encapsulated site parser, so everything happens through Mozilla FireFox. Now I need to place this bot on the server, but what to do with FireFox, just install it in the same folder where the bot is located?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
UberPool, 2021-08-10
@UberPool

You have a call from the script to the browser, you just specify the path to the browser.
Accordingly:
1. You download the browser to the N directory.
2. In the script you specify the full / relative path to the browser.
3. Testing.

M
Michael, 2021-08-19
@moonz

I recommend using chrome, it is not so easy to install of course, but all that will be needed is the latest version of the chrome driver.
Steps:
1) Install on the server (depending on the configuration), browser *preferably chrome, but fox is also possible.
2) Download the chrome or geco driver (depending on the chosen browser).
3) Write the path to the driver in the code, through the option argument of the browser instance.
4) Register the option of hidden mode * if chrome then the code:

op = webdriver.ChromeOptions()
op.add_argument('--headless')
driver = webdriver.Chrome(options=op)

If fox, then you can use this:
#install Xvfb
sudo apt-get install xvfb

#set display number to :99
Xvfb :99 -ac &
export DISPLAY=:99    

#you are now having an X display by Xvfb

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question