Skip to content

Commit

Permalink
merged with github version
Browse files Browse the repository at this point in the history
  • Loading branch information
eracle committed Jan 17, 2020
2 parents 5fc3b17 + 70717d3 commit f99302d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.venv
.pytest_cache
.idea
__pycache__
.vscode
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ companies:
scrapy crawl companies -a selenium_hostname=localhost -o users.csv

tests:
pytest linkedin/tests/*
pytest linkedin/tests/*
1 change: 1 addition & 0 deletions linkedin/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ class LinkedinUser(scrapy.Item):
name = scrapy.Field()
title = scrapy.Field()
company = scrapy.Field()
link = scrapy.Field()
7 changes: 5 additions & 2 deletions linkedin/spiders/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def extracts_see_all_url(driver):

a_elem = driver.find_element_by_link_text(see_all_ex_text)
see_all_url = a_elem.get_attribute('href')

print(f'Found the following URL: {see_all_url}')
return see_all_url

Expand All @@ -141,13 +140,17 @@ def extracts_linkedin_users(driver, company):
result = get_by_xpath_or_none(driver, last_result_xpath)
if result is not None:


link_elem = get_by_xpath_or_none(result, './/*[@class="search-result__result-link ember-view"]')
link = link_elem.get_attribute('href') if link_elem is not None else None

name_elem = get_by_xpath_or_none(result, './/*[@class="name actor-name"]')
name = name_elem.text if name_elem is not None else None

title_elem = get_by_xpath_or_none(result, './/p')
title = title_elem.text if name_elem is not None else None

user = LinkedinUser(name=name, title=title, company=company)
user = LinkedinUser(name=name, title=title, company=company, link=link)

yield user

Expand Down
2 changes: 1 addition & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ selenium>=3.14.0 # pyup: < 4.0 # https://github.com/SeleniumHQ/selenium

# Testing
# todo: move them to a dedicated req file
pytest==5.3.1
pytest==5.3.2
pytest-sugar==0.9.2

# Linkedin API library
Expand Down

0 comments on commit f99302d

Please sign in to comment.