8000 automate excel file generation of GSoC 2018 organizations data for better readability by Gateway2745 · Pull Request #181 · codezoned/ScriptsDump · GitHub
[go: up one dir, main page]

Skip to content

automate excel file generation of GSoC 2018 organizations data for better readability #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
automate excel file generation of GSoC 2018 organizations data for be…
…tter readability
  • Loading branch information
Gateway2745 committed Oct 5, 2019
commit c8f2f4c17509edd2dcd581838a2a5b3bc5492056
4 changes: 4 additions & 0 deletions Automation/src/GSoC-Organizations-Data/requirements.txt
FA41
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pkg-resources==0.0.0
selenium==3.141.0
urllib3==1.25.3
XlsxWriter==1.1.8
Binary file not shown.
53 changes: 53 additions & 0 deletions Automation/src/GSoC-Organizations-Data/scraper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
import time
import xlsxwriter

browser = webdriver.Firefox()
url="https://summerofcode.withgoogle.com/organizations/?sp-page=5"
browser.get(url)

delay = 5

try:
elms = WebDriverWait(browser, delay).until(EC.presence_of_element_located((By.CLASS_NAME, 'organization-card__container')))
print("Page is ready!")
html=browser.page_source
workbook = xlsxwriter.Workbook('results.xlsx')
worksheet = workbook.add_worksheet()
row = 1
col = 0
bold = workbook.add_format({'bold': True})
worksheet.set_column(0, 2, 70)
worksheet.set_column(3, 3, 150)
worksheet.write(0, 0, 'ORGANISATION NAME', bold)
worksheet.write(0, 1, 'TECHNOLOGIES', bold)
worksheet.write(0, 2, 'TOPIC CATEGORY', bold)
worksheet.write(0, 3, 'TOPIC NAMES', bold)

orgs = browser.find_elements_by_class_name('organization-card__container')
for org in orgs:
org.click()
elms = WebDriverWait(browser, delay).until(EC.presence_of_element_located((By.CLASS_NAME, 'organization__tag--topic')))
org_name = browser.find_element_by_class_name('organization-card__title').text
worksheet.write(row, col, org_name)
tech_tags = browser.find_elements_by_class_name('organization__tag--technology')
tags_text = ''
for tag in tech_tags:
tags_text += tag.text + ','
worksheet.write(row, col+1, tags_text)
topic_cat = browser.find_element_by_class_name('organization__tag--category').text
worksheet.write(row, col+2, topic_cat)
topics = browser.find_elements_by_class_name('organization__tag--topic')
topics_text =''
for topic in topics:
topics_text += topic.text + ','
worksheet.write(row, col+3, topics_text)
row += 1
workbook.close()

except TimeoutException:
print("Loading took too much time!")
0