Created
February 8, 2022 03:51
-
-
Save LordGhostX/e6bc36062eeaf3dcbe270389e86103f8 to your computer and use it in GitHub Desktop.
Job Scraper for web3.career
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
def scrape_webpage(page): | |
r = requests.get(f"https://web3.career/remote-jobs?page={page}") | |
webpage = BeautifulSoup(r.text, "html.parser") | |
table_section = webpage.find("tbody", {"class": "tbody"}) | |
jobs_data = "" | |
for i in table_section.find_all("tr"): | |
try: | |
role = i.h2.text.strip() | |
company = i.h3.text.strip() | |
salary = i.p.text.strip() | |
link = f"https://web3.career/{i.a['href'][3:]}" | |
jobs_data += f"{role},{company},{salary},{link}\n" | |
except: | |
pass | |
return jobs_data | |
jobs_data = "role,company,salary,link\n" | |
for i in range(1, 20): | |
print("Scraping page", i) | |
jobs_data += scrape_webpage(i) | |
open("jobs.csv", "w").write(jobs_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment