mirror of
https://github.com/NohamR/Bibmath2Tex.git
synced 2026-05-24 19:58:43 +00:00
pushh
This commit is contained in:
40
gen.sh
Executable file
40
gen.sh
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
DUMP_DIR="dump"
|
||||||
|
OUTPUT_DIR="output"
|
||||||
|
TEX_CMD="pdflatex"
|
||||||
|
|
||||||
|
# Create output directory if it doesn't exist
|
||||||
|
mkdir -p "$OUTPUT_DIR"
|
||||||
|
|
||||||
|
# Check if dump directory exists
|
||||||
|
if [ ! -d "$DUMP_DIR" ]; then
|
||||||
|
echo "Error: $DUMP_DIR directory does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Process all .tex files in the dump directory
|
||||||
|
echo "Processing .tex files from $DUMP_DIR..."
|
||||||
|
for tex_file in "$DUMP_DIR"/*.tex; do
|
||||||
|
# Check if there are any .tex files
|
||||||
|
if [ ! -f "$tex_file" ]; then
|
||||||
|
echo "No .tex files found in $DUMP_DIR"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
filename=$(basename "$tex_file")
|
||||||
|
echo "Processing $filename..."
|
||||||
|
|
||||||
|
# Run pdflatex
|
||||||
|
$TEX_CMD -output-directory="$OUTPUT_DIR" "$tex_file"
|
||||||
|
|
||||||
|
# Check if successful
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Successfully generated PDF for $filename"
|
||||||
|
else
|
||||||
|
echo "Error generating PDF for $filename"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All processing complete. Output files are in $OUTPUT_DIR"
|
||||||
68
grab.py
68
grab.py
@@ -29,6 +29,10 @@ class Part:
|
|||||||
|
|
||||||
class Chapitre:
|
class Chapitre:
|
||||||
def __init__(self, title, url=None):
|
def __init__(self, title, url=None):
|
||||||
|
if ':' in title:
|
||||||
|
title = title.split(':')[1].strip()
|
||||||
|
title = title.lower()
|
||||||
|
title = title[0].upper() + title[1:] if title else ""
|
||||||
self.title = title
|
self.title = title
|
||||||
self.parts = []
|
self.parts = []
|
||||||
self.url = url
|
self.url = url
|
||||||
@@ -124,7 +128,26 @@ class LatexFile:
|
|||||||
self.add_footer()
|
self.add_footer()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def fetch_chapitre(quoi):
|
def parse(content):
|
||||||
|
soup2 = BeautifulSoup(str(content), 'lxml')
|
||||||
|
for tag in soup2.find_all(['span', 'a', 'img']):
|
||||||
|
tag.extract()
|
||||||
|
questions = []
|
||||||
|
ol_list = soup2.find('ol', class_='enumeratechiffre')
|
||||||
|
|
||||||
|
if ol_list:
|
||||||
|
for i, li in enumerate(ol_list.find_all('li'), 1):
|
||||||
|
if i == 1:
|
||||||
|
# Add a line break before the first question
|
||||||
|
questions.append("\\par")
|
||||||
|
questions.append(f"{i}. {li.get_text().strip()}")
|
||||||
|
list_text = "\n\n".join(questions)
|
||||||
|
ol_list.replace_with(list_text)
|
||||||
|
|
||||||
|
content = soup2.get_text().strip()
|
||||||
|
return content
|
||||||
|
|
||||||
|
def fetch_chapitre(page):
|
||||||
headers = {
|
headers = {
|
||||||
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
|
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
|
||||||
'accept-language': 'fr-FR,fr;q=0.7',
|
'accept-language': 'fr-FR,fr;q=0.7',
|
||||||
@@ -142,12 +165,7 @@ def fetch_chapitre(quoi):
|
|||||||
'upgrade-insecure-requests': '1',
|
'upgrade-insecure-requests': '1',
|
||||||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
||||||
}
|
}
|
||||||
params = {
|
response = requests.get(page, headers=headers)
|
||||||
'action': 'affiche',
|
|
||||||
'quoi': quoi,
|
|
||||||
'type': 'fexo',
|
|
||||||
}
|
|
||||||
response = requests.get('https://bibmath.net/ressources/index.php', headers=headers, params=params)
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
soup = BeautifulSoup(response.text, 'lxml')
|
soup = BeautifulSoup(response.text, 'lxml')
|
||||||
article = soup.find('article', id='contenugauche')
|
article = soup.find('article', id='contenugauche')
|
||||||
@@ -175,20 +193,16 @@ def fetch_chapitre(quoi):
|
|||||||
|
|
||||||
stars_count = len(exo_title_div.find_all('img'))
|
stars_count = len(exo_title_div.find_all('img'))
|
||||||
|
|
||||||
enonce = element.find('div', class_='enonce').find('div', class_='inner').get_text(strip=True)
|
enonce = element.find('div', class_='enonce').find('div', class_='inner')
|
||||||
if ".Existe-t" in enonce:
|
enonce = parse(enonce)
|
||||||
print(element)
|
|
||||||
indication_div = element.find('div', class_='indication')
|
indication_div = element.find('div', class_='indication')
|
||||||
indication = (
|
indication = indication_div.find('div', class_='inner')
|
||||||
indication_div.find('div', class_='inner').get_text(strip=True)
|
indication = parse(indication)
|
||||||
if indication_div else "No indication"
|
|
||||||
)
|
|
||||||
|
|
||||||
answer_div = element.find('div', class_='corrige')
|
answer_div = element.find('div', class_='corrige')
|
||||||
answer = (
|
answer = answer_div.find('div', class_='inner')
|
||||||
answer_div.find('div', class_='inner').get_text(strip=True)
|
answer = parse(answer)
|
||||||
if answer_div else "No answer"
|
|
||||||
)
|
|
||||||
|
|
||||||
exercise = Exercise(
|
exercise = Exercise(
|
||||||
number=exercise_number,
|
number=exercise_number,
|
||||||
@@ -207,9 +221,17 @@ def fetch_chapitre(quoi):
|
|||||||
else:
|
else:
|
||||||
print(f"Request failed with status code: {response.status_code}")
|
print(f"Request failed with status code: {response.status_code}")
|
||||||
|
|
||||||
quoi = 'mpsi/feuillesexo/matrices'
|
def get_page(page):
|
||||||
chapitre = fetch_chapitre(quoi)
|
chapitre = fetch_chapitre(page)
|
||||||
|
title = chapitre.title
|
||||||
|
latex_file = LatexFile(f'dump/{title}.tex')
|
||||||
|
latex_file.generate_latex(chapitre)
|
||||||
|
print(f"LaTeX file generated: dump/{title}.tex")
|
||||||
|
|
||||||
latex_file = LatexFile('file.tex')
|
if __name__ == "__main__":
|
||||||
latex_file.generate_latex(chapitre)
|
# page = "https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/prehilbert&type=fexo"
|
||||||
print("LaTeX file generated: file.tex")
|
# get_page(page)
|
||||||
|
with open('pages.txt', 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
page = line.strip()
|
||||||
|
get_page(page)
|
||||||
19
pages_spé.txt
Normal file
19
pages_spé.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/groupe&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/anneau&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/alglin&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/reduction&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/polynomeendomorphisme&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/endoeuclidien&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/evn&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/topoevn&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/complementstopo&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/vectorielle&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/integralesimpropres&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/foncdefintegrales&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/serie&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/suiserfonc&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/serieent&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/equadiffs&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/calculdiff&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/espacesproba&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mathspe/feuillesexo/vadiscrete&type=fexo
|
||||||
34
pages_sup.txt
Normal file
34
pages_sup.txt
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/logique&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/ensembleapplicationrelation&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/calculalgebrique&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/systemeslineaires&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/inegalites&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/trigo&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/complexes&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/foncusu&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/primitives&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/equadiffs&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/reels&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/suites&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/limitecontinuite&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/derivee&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/convexe&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/arithmetique&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/matrices&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/groupeanneaucorps&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/polynomes&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/fracrat&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/compafonctions&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/dls&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/integration&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/series&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/famillessommables&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/ev&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/dimfinie&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/al&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/matricesal&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/determinant&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/prehilbert&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/denombrement&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/espaceproba&type=fexo
|
||||||
|
https://bibmath.net/ressources/index.php?action=affiche&quoi=mpsi/feuillesexo/va&type=fexo
|
||||||
BIN
spé/Endomorphismes des espaces euclidiens.pdf
Normal file
BIN
spé/Endomorphismes des espaces euclidiens.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices de compléments d'algèbre linéaire.pdf
Normal file
BIN
spé/Exercices de compléments d'algèbre linéaire.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
spé/Exercices sur la réduction d'endomorphismes.pdf
Normal file
BIN
spé/Exercices sur la réduction d'endomorphismes.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur la topologie des espaces vectoriels normés.pdf
Normal file
BIN
spé/Exercices sur la topologie des espaces vectoriels normés.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur le calcul différentiel.pdf
Normal file
BIN
spé/Exercices sur le calcul différentiel.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les anneaux.pdf
Normal file
BIN
spé/Exercices sur les anneaux.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les espaces probabilisés.pdf
Normal file
BIN
spé/Exercices sur les espaces probabilisés.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les espaces vectoriels normés.pdf
Normal file
BIN
spé/Exercices sur les espaces vectoriels normés.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les fonctions intégrables.pdf
Normal file
BIN
spé/Exercices sur les fonctions intégrables.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les fonctions à valeurs vectorielles.pdf
Normal file
BIN
spé/Exercices sur les fonctions à valeurs vectorielles.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les intégrales à paramètres.pdf
Normal file
BIN
spé/Exercices sur les intégrales à paramètres.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les polynômes d'endomorphismes.pdf
Normal file
BIN
spé/Exercices sur les polynômes d'endomorphismes.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les suites et séries de fonctions.pdf
Normal file
BIN
spé/Exercices sur les suites et séries de fonctions.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les séries entières.pdf
Normal file
BIN
spé/Exercices sur les séries entières.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les séries.pdf
Normal file
BIN
spé/Exercices sur les séries.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les variables aléatoires discrètes.pdf
Normal file
BIN
spé/Exercices sur les variables aléatoires discrètes.pdf
Normal file
Binary file not shown.
BIN
spé/Exercices sur les équations différentielles.pdf
Normal file
BIN
spé/Exercices sur les équations différentielles.pdf
Normal file
Binary file not shown.
BIN
spé/Groupes.pdf
Normal file
BIN
spé/Groupes.pdf
Normal file
Binary file not shown.
BIN
sup/Applications linéaires.pdf
Normal file
BIN
sup/Applications linéaires.pdf
Normal file
Binary file not shown.
BIN
sup/Arithmétique.pdf
Normal file
BIN
sup/Arithmétique.pdf
Normal file
Binary file not shown.
BIN
sup/Calcul algébrique.pdf
Normal file
BIN
sup/Calcul algébrique.pdf
Normal file
Binary file not shown.
BIN
sup/Calcul matriciel.pdf
Normal file
BIN
sup/Calcul matriciel.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
sup/Comparaison des suites et des fonctions.pdf
Normal file
BIN
sup/Comparaison des suites et des fonctions.pdf
Normal file
Binary file not shown.
BIN
sup/Dénombrement.pdf
Normal file
BIN
sup/Dénombrement.pdf
Normal file
Binary file not shown.
BIN
sup/Dérivabilité.pdf
Normal file
BIN
sup/Dérivabilité.pdf
Normal file
Binary file not shown.
BIN
sup/Développements limités.pdf
Normal file
BIN
sup/Développements limités.pdf
Normal file
Binary file not shown.
BIN
sup/Ensembles, applications,relations.pdf
Normal file
BIN
sup/Ensembles, applications,relations.pdf
Normal file
Binary file not shown.
BIN
sup/Espaces préhilbertiens et euclidiens.pdf
Normal file
BIN
sup/Espaces préhilbertiens et euclidiens.pdf
Normal file
Binary file not shown.
BIN
sup/Espaces vectoriels de dimension finie.pdf
Normal file
BIN
sup/Espaces vectoriels de dimension finie.pdf
Normal file
Binary file not shown.
BIN
sup/Espaces vectoriels.pdf
Normal file
BIN
sup/Espaces vectoriels.pdf
Normal file
Binary file not shown.
BIN
sup/Exercices sur les familles sommables.pdf
Normal file
BIN
sup/Exercices sur les familles sommables.pdf
Normal file
Binary file not shown.
BIN
sup/Exercies sur les nombres réels.pdf
Normal file
BIN
sup/Exercies sur les nombres réels.pdf
Normal file
Binary file not shown.
BIN
sup/Fonctions convexes.pdf
Normal file
BIN
sup/Fonctions convexes.pdf
Normal file
Binary file not shown.
BIN
sup/Fonctions usuelles.pdf
Normal file
BIN
sup/Fonctions usuelles.pdf
Normal file
Binary file not shown.
BIN
sup/Fractions rationnelles.pdf
Normal file
BIN
sup/Fractions rationnelles.pdf
Normal file
Binary file not shown.
BIN
sup/Groupe symétrique et déterminant.pdf
Normal file
BIN
sup/Groupe symétrique et déterminant.pdf
Normal file
Binary file not shown.
BIN
sup/Groupes, anneaux, corps.pdf
Normal file
BIN
sup/Groupes, anneaux, corps.pdf
Normal file
Binary file not shown.
BIN
sup/Intégrale d'une fonction continue sur un segment.pdf
Normal file
BIN
sup/Intégrale d'une fonction continue sur un segment.pdf
Normal file
Binary file not shown.
BIN
sup/Inégalités.pdf
Normal file
BIN
sup/Inégalités.pdf
Normal file
Binary file not shown.
BIN
sup/Limite de fonctions - continuité.pdf
Normal file
BIN
sup/Limite de fonctions - continuité.pdf
Normal file
Binary file not shown.
BIN
sup/Matrices et applications linéaires.pdf
Normal file
BIN
sup/Matrices et applications linéaires.pdf
Normal file
Binary file not shown.
BIN
sup/Nombres complexes.pdf
Normal file
BIN
sup/Nombres complexes.pdf
Normal file
Binary file not shown.
BIN
sup/Polynômes.pdf
Normal file
BIN
sup/Polynômes.pdf
Normal file
Binary file not shown.
BIN
sup/Probabilités sur un univers fini.pdf
Normal file
BIN
sup/Probabilités sur un univers fini.pdf
Normal file
Binary file not shown.
BIN
sup/Rudiments de logique.pdf
Normal file
BIN
sup/Rudiments de logique.pdf
Normal file
Binary file not shown.
BIN
sup/Suites de nombres réels et complexes.pdf
Normal file
BIN
sup/Suites de nombres réels et complexes.pdf
Normal file
Binary file not shown.
BIN
sup/Systèmes linéaires.pdf
Normal file
BIN
sup/Systèmes linéaires.pdf
Normal file
Binary file not shown.
BIN
sup/Séries numériques.pdf
Normal file
BIN
sup/Séries numériques.pdf
Normal file
Binary file not shown.
BIN
sup/Trigonométrie.pdf
Normal file
BIN
sup/Trigonométrie.pdf
Normal file
Binary file not shown.
BIN
sup/Variables aléatoires finies.pdf
Normal file
BIN
sup/Variables aléatoires finies.pdf
Normal file
Binary file not shown.
BIN
sup/Équations différentielles linéaires.pdf
Normal file
BIN
sup/Équations différentielles linéaires.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user