Hello Everyone, In this tutorial, we are going to learn Python 3 Selenium to Scrape Number of Online Users in Omegle and Display it in Command Line.
Python 3 Selenium to Scrape Number of Online Users in Omegle and Display it in Command Line
It is very easy and simple to follow these steps with me. You need Python and PyCharm IDE on your PC (or you can use one of your IDEs).
First, run the python script below to download the latest selenium chrome driver to your root directory. It’s automatic
saved as chromedriver.exe as shown below
import requests import wget import zipfile import os # get the latest chrome driver version number url = 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE' response = requests.get(url) version_number = response.text # build the donwload url download_url = "https://chromedriver.storage.googleapis.com/" + version_number +"/chromedriver_win32.zip" # download the zip file using the url built above latest_driver_zip = wget.download(download_url,'chromedriver.zip') # extract the zip file with zipfile.ZipFile(latest_driver_zip, 'r') as zip_ref: zip_ref.extractall() # you can specify the destination folder path here # delete the zip file downloaded above os.remove(latest_driver_zip)
First, you need to install, type command in your terminal “pip install selenium”.
from selenium import webdriver from selenium.webdriver.chrome.options import Options import re options = Options() options.headless = True options.add_argument("--window-size=1920,1200") count="" driver = webdriver.Chrome(options=options, executable_path="chromedriver.exe") driver.get("http://front1.omegle.com/status") element = driver.find_element_by_xpath('/html/body').text for x in element: if x == ',': break count+= x users = re.sub('[^0-9,.]', '', count) print("Omegle Online Users Right Now is " + users) driver.quit()
pip install app.py
Here we clearly understood the Python 3 Selenium to Scrape Number of Online Users in Omegle and Display it in Command Line. If you want to learn salesforce and Double Verify. Please check below links.
- How to Download Instagram Profile Picture with Python 3 Instaloader Script?
- Python 3 Truecaller API Web Scraping