<jupyter_start><jupyter_text>JobPaw Web Scraping Project<jupyter_code># import libraries 

from bs4 import BeautifulSoup
import requests
import pandas as pd


URL = 'https://www.jobpaw.com/pont/professionnels.php?pageNum_RS_job=0&totalRows_RS_job=10622&id=55'
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36", "Accept-Encoding":"gzip, deflate", "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "DNT":"1","Connection":"close", "Upgrade-Insecure-Requests":"1"}
webpage = requests.get(URL, headers=headers)

soup1 = BeautifulSoup(webpage.content, "html.parser")

soup2 = BeautifulSoup(soup1.prettify(), "html.parser")
tables = soup2.find_all('table',class_='table table-hover table-bordered')

    
    
print(tables)
df =pd.read_html(URL)
df[1]
from bs4 import BeautifulSoup
from selenium import webdriver
import pandas as pd
import time
df = pd.DataFrame(columns = ['Institution', 'Titre_du_poste', 'Domaine', 'Date'])
pages =  212
for page in range(0,pages):
    url =f"https://www.jobpaw.com/pont/professionnels.php?pageNum_RS_job={page}&totalRows_RS_job=10622&id=55"
    print(url)
    brower = webdriver.Chrome()
    brower.get(url)
    soup = BeautifulSoup(brower.page_source ,'html5')
    tables = soup.find_all('table',class_='table table-hover table-bordered')
    tbody = tables[0].find_all('tbody')
    trs = tbody[0].find_all('tr')
    for tr in trs:
        tds = tr.find_all('td')
        if len(tds) == 4 :
            company =  tds[0].get_text().strip()
            post =  tds[1].get_text().strip()
            domaine =  tds[2].get_text().strip()
            date_limit =  tds[3].get_text()
            df = df.append({'Institution': company, 'Titre_du_poste': post, 'Domaine': domaine, 'Date' : date_limit}, ignore_index=True)
            
            


df
# Create a CSV file to export the data

import csv 

with open('Jobpawdata.csv', 'w', newline='', encoding='UTF8') as f:
        writer = csv.writer(f)
        data = df.to_csv('Jobpawdata.csv', index = False)
#Combine all of the above code into one function

def Jobpaw_WebScraping(number_of_page):
    from bs4 import BeautifulSoup
    from selenium import webdriver
    import pandas as pd
    import time
    import csv
    
    df = pd.DataFrame(columns = ['Institution', 'Titre_du_poste', 'Domaine', 'Date'])
    pages =  3
    for page in range(0,pages):
        url =f"https://www.jobpaw.com/pont/professionnels.php?pageNum_RS_job={page}&totalRows_RS_job=10622&id=55"
        print(url)
        brower = webdriver.Chrome()
        brower.get(url)
        soup = BeautifulSoup(brower.page_source ,'html5')
        tables = soup.find_all('table',class_='table table-hover table-bordered')
        tbody = tables[0].find_all('tbody')
        trs = tbody[0].find_all('tr')
        for tr in trs:
            tds = tr.find_all('td')
            if len(tds) == 4 :
                company =  tds[0].get_text().strip()
                post =  tds[1].get_text().strip()
                domaine =  tds[2].get_text().strip()
                date_limit =  tds[3].get_text()
                df = df.append({'Institution': company, 'Titre_du_poste': post, 'Domaine': domaine, 'Date' : date_limit}, ignore_index=True)
       
    with open('Jobpawdata.csv', 'w', newline='', encoding='UTF8') as f:
        writer = csv.writer(f)
        data = df.to_csv('Jobpawdata.csv', index = False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1488876212207644, 'fraction_numerical': 0.025099828864803195, 'mean_word_length': 3.308353808353808, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '517541', 'license': 'MIT', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1244, 'n_words': 244, 'path': 'Jobpaw Web Scraping/WebScraping.ipynb', 'repo_name': 'chedelino/PortfolioProject', 'size': '3506'}