Skip to content

Instantly share code, notes, and snippets.

@billmetangmo
Created March 15, 2023 14:08
Show Gist options
  • Select an option

  • Save billmetangmo/74e793ec61ec4d663be0552a4e1df19e to your computer and use it in GitHub Desktop.

Select an option

Save billmetangmo/74e793ec61ec4d663be0552a4e1df19e to your computer and use it in GitHub Desktop.
Scrape conferences from intertesting events https://www.solutions-ressources-humaines.com
# %%
! pip install selectolax requests
# %%
import csv
with open("urls.csv") as f:
reader = csv.reader(f)
urls = list(reader)
print(urls)
# %%
import requests
from selectolax.parser import HTMLParser
for url in urls:
response = requests.get(url[0])
html = response.text
parser = HTMLParser(html)
date = parser.css_first("table:nth-child(4) > tbody > tr > td > strong,table:nth-child(5) strong").text()
description = parser.css_first("table:nth-child(3) .font-home-12").text()
description = description.replace("\t", "").replace("\n", "").strip()
title = parser.css_first(".font-titre-detail > b").text()
with open("conference.txt", "a") as file:
file.write(f"Date: {date}\n")
file.write(f"Titre: {title}\n")
file.write(f"Description: {description}\n")
file.write("-----\n")
# %%
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
https://www.solutions-ressources-humaines.com/info_event/1371/digital-learning-v%C3%A9hicule-tout-terrain-de-la-formation.html
https://www.solutions-ressources-humaines.com/info_event/1351/la-fonction-rh-face-aux-grands-bouleversements.html
https://www.solutions-ressources-humaines.com/info_event/1390/ce-que-lanalyse-des-donn%C3%A9es-peut-r%C3%A9v%C3%A9ler-sur-une-strat%C3%A9gie-de-recrutement.html
https://www.solutions-ressources-humaines.com/info_event/1372/r%C3%A9tention-des-talents-quelles-strat%C3%A9gies-.html
https://www.solutions-ressources-humaines.com/info_event/1393/quelles-comp%C3%A9tences-pour-l%E2%80%99engagement--3-comp%C3%A9tences-cl%C3%A9s-partag%C3%A9es-par-les-managers-ayant-b%C3%A2ti-une-%C3%A9quipe-hautement-engag%C3%A9e.html
https://www.solutions-ressources-humaines.com/info_event/1297/les-enjeux-m%C3%A9tiers-de-la-transformation-rh-pour-2023.html
https://www.solutions-ressources-humaines.com/info_event/1349/engagement-d%C3%A9sengagement-et-si-on-se-trompait-d%E2%80%99objectif-.html
https://www.solutions-ressources-humaines.com/info_event/1385/digital-learning--disruption-en-vue-.html
https://www.solutions-ressources-humaines.com/info_event/1363/productivit%C3%A9--l%E2%80%99arriv%C3%A9e-du-recrutement-augment%C3%A9-par-ia.html
https://www.solutions-ressources-humaines.com/info_event/1357/la-transparence-des-salaires-cest-demain--comment-sy-pr%C3%A9parer-et-quels-avantages-en-tirer-.html
https://www.solutions-ressources-humaines.com/info_event/1322/enqu%C3%AAte-sur-les-d%C3%A9fis-cl%C3%A9s-de-la-gestion-des-talents-en-2023--rester-comp%C3%A9titif-sur-le-march%C3%A9-du-travail.html
https://www.solutions-ressources-humaines.com/info_event/1335/ressources-humaines--quelles-sont-les-nouvelles-priorit%C3%A9s-de-2023-.html
https://www.solutions-ressources-humaines.com/info_event/1377/avezvous-bien-compris-l%E2%80%99impact-de-chatgpt-sur-les-rh--les-3-%C3%A9cueils-%C3%A0-%C3%A9viter-et-les-3-cl%C3%A9s-pour-en-profiter-au-maximum.html
https://www.solutions-ressources-humaines.com/info_event/1396/4-%C3%A9tapes-pour-une-culture-dapprentissage-durable.html
https://www.solutions-ressources-humaines.com/info_event/1387/recrutement--candidats-et-rh-sontils-en-phase-.html
https://www.solutions-ressources-humaines.com/info_event/1382/chat-gpt-ia-et-m%C3%A9tavers--quelles-perspectives-pour-la-formation-.html
https://www.solutions-ressources-humaines.com/info_event/1382/chat-gpt-ia-et-m%C3%A9tavers--quelles-perspectives-pour-la-formation-.html
https://www.solutions-ressources-humaines.com/info_event/1311/du-mobile-learning-au-lms--et-si-on-napprenait-pas-de-la-bonne-mani%C3%A8re-.html
https://www.solutions-ressources-humaines.com/info_event/1355/pourquoi-estil-si-compliqu%C3%A9-de-recruter-aujourdhui-et-comment-palier-%C3%A0-ces-difficult%C3%A9s-.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment