Skip to content

Instantly share code, notes, and snippets.

@Ilyaok
Created October 2, 2020 15:31
Show Gist options
  • Select an option

  • Save Ilyaok/ccdee6f5d7b5da84b6db33cffc4a3b76 to your computer and use it in GitHub Desktop.

Select an option

Save Ilyaok/ccdee6f5d7b5da84b6db33cffc4a3b76 to your computer and use it in GitHub Desktop.

Revisions

  1. Ilyaok created this gist Oct 2, 2020.
    34 changes: 34 additions & 0 deletions HAYS_Scraping.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    from urllib.request import urlopen
    from bs4 import BeautifulSoup
    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    import time
    import pandas as pd

    driver = webdriver.Chrome('C:/Users/Илья/Downloads/chromedriver_win32/chromedriver.exe')
    driver.get("https://hays.ru/search/")

    for i in range(5):
    driver.find_element_by_tag_name('body').send_keys(Keys.END)
    time.sleep(1)

    VacHeads = []
    for temp in driver.find_elements_by_tag_name("h3"):
    VacHeads.append(temp.text)

    Industries = []
    for temp in driver.find_elements_by_class_name("svc-search-results__position"):
    Industries.append(temp.find_element_by_tag_name("p").text)

    Locations = []
    for temp in driver.find_elements_by_class_name("locations-labl"):
    Locations.append(temp.find_element_by_tag_name("span").text)

    table = {"Vacancy": VacHeads, "Industry": Industries, "Location": Locations}
    frame = pd.DataFrame(table)

    writer = pd.ExcelWriter("Hays_Vacancies.xlsx", engine='xlsxwriter')
    frame.to_excel(writer, "Vacancies")
    writer.save()

    driver.close()