mirror of
https://github.com/NohamR/Manuel.git
synced 2025-05-24 00:49:10 +00:00
add nathan
This commit is contained in:
parent
6d9e2774ba
commit
7ac5a429b4
File diff suppressed because one or more lines are too long
43
index.html
43
index.html
@ -28,7 +28,7 @@
|
||||
<div>
|
||||
<a href="rechercher.html">Cherche ton code ici</a>
|
||||
</div>
|
||||
<input type="text" id="code" name="code" value="9782017102106">
|
||||
<input type="text" id="code" name="code" value="9782091317243">
|
||||
<button onclick="urlachanger()">Changer de livre</button>
|
||||
</div>
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
<option value="sesa">Sesamath</option>
|
||||
<option value="magnard">Magnard</option>
|
||||
<option value="delagrave">Delagrave</option>
|
||||
<option value="nathan">Nathan</option>
|
||||
|
||||
</select>
|
||||
<p id="editionesthcoisieest"></p>
|
||||
@ -210,13 +211,23 @@
|
||||
document.documentElement.style.setProperty('--iframe-height', '2050px');
|
||||
}
|
||||
else if (editionchoisie == 'delagrave') {
|
||||
console.log("magnard");
|
||||
document.getElementById("editionesthcoisieest").innerHTML = "Le serveur n°1 devrait marcher mais au cas où les autres sont dispos.";
|
||||
console.log("delagrave");
|
||||
document.getElementById("editionesthcoisieest").innerHTML = "";
|
||||
diviframe.style.display = '';
|
||||
slider.style.display = '';
|
||||
divimg.style.display = 'none';
|
||||
divserver.style.display = '';
|
||||
}
|
||||
else if (editionchoisie == 'nathan') {
|
||||
console.log("nathan");
|
||||
document.getElementById("editionesthcoisieest").innerHTML = "";
|
||||
diviframe.style.display = '';
|
||||
slider.style.display = '';
|
||||
divimg.style.display = 'none';
|
||||
divserver.style.display = 'none';
|
||||
document.documentElement.style.setProperty('--iframe-width', '1152px');
|
||||
document.documentElement.style.setProperty('--iframe-height', '1594px');
|
||||
}
|
||||
else {
|
||||
document.getElementById("editionesthcoisieest").innerHTML = "⚠ Cette édition n'est pas encore supportée ⚠";
|
||||
diviframe.style.display = 'none';
|
||||
@ -286,6 +297,12 @@
|
||||
iframe1.src = newUrl1;
|
||||
iframe2.src = newUrl2;
|
||||
}
|
||||
else if (editionchoisie == 'nathan') {
|
||||
var newUrl1 = "https://raw.githubusercontent.com/NohamR/Manuelcontent/main/Nathan/" + code + "/page0.jpg";
|
||||
var newUrl2 = "https://raw.githubusercontent.com/NohamR/Manuelcontent/main/Nathan/" + code + "/page1.jpg";
|
||||
img1.src = newUrl1;
|
||||
img2.src = newUrl2;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
@ -421,6 +438,26 @@
|
||||
console.log(img2.src);
|
||||
nbpage.value = page1;
|
||||
}
|
||||
else if (editionchoisie == 'nathan') {
|
||||
// console.log("nathan");
|
||||
page1 += delta;
|
||||
page2 += delta;
|
||||
if (page1 < 1) {
|
||||
page1 = 1;
|
||||
} else if (page1 > 600) {
|
||||
page1 = 600;
|
||||
}
|
||||
if (page2 < 1) {
|
||||
page2 = 2;
|
||||
} else if (page2 > 600) {
|
||||
page2 = 600;
|
||||
}
|
||||
img1.src = url1.replace(/\d+(?=\.jpg)/, page1);
|
||||
img2.src = url2.replace(/\d+(?=\.jpg)/, page2);
|
||||
console.log(img1.src);
|
||||
console.log(img2.src);
|
||||
nbpage.value = page1;
|
||||
}
|
||||
}
|
||||
|
||||
function changerNBpage() {
|
||||
|
BIN
py/.DS_Store
vendored
Normal file
BIN
py/.DS_Store
vendored
Normal file
Binary file not shown.
1
py/code1.0.ipynb
Normal file
1
py/code1.0.ipynb
Normal file
File diff suppressed because one or more lines are too long
BIN
py/nathan/.DS_Store
vendored
Normal file
BIN
py/nathan/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
py/nathan/9782091317243/.DS_Store
vendored
Normal file
BIN
py/nathan/9782091317243/.DS_Store
vendored
Normal file
Binary file not shown.
49
py/nathan/get.py
Normal file
49
py/nathan/get.py
Normal file
@ -0,0 +1,49 @@
|
||||
# https://biblio.nathan.fr/epubs/web/4ebeff9ce5eb568f8142771fdac580b8aeb12f675d75fa4c1ebb4620050d6c01842394910eeee327/NATHAN/bibliomanuels/distrib_gp/2/1/10300/online/OEBPS/TOC.xhtml
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import re
|
||||
|
||||
|
||||
def getimg(url, nb):
|
||||
response = requests.get(url)
|
||||
if response.status_code == 200:
|
||||
save_path = f"9782091317243/{nb}.jpg"
|
||||
with open(save_path, 'wb') as file:
|
||||
file.write(response.content)
|
||||
print(f"The image has been saved as '{save_path}'")
|
||||
else:
|
||||
print(f"Failed to download the image. Status code: {response.status_code}")
|
||||
|
||||
|
||||
url = 'https://biblio.nathan.fr/epubs/web/4ebeff9ce5eb568f8142771fdac580b8aeb12f675d75fa4c1ebb4620050d6c01842394910eeee327/NATHAN/bibliomanuels/distrib_gp/2/1/10300/online/OEBPS/TOC.xhtml'
|
||||
debut = 'https://biblio.nathan.fr/epubs/web/4ebeff9ce5eb568f8142771fdac580b8aeb12f675d75fa4c1ebb4620050d6c01842394910eeee327/NATHAN/bibliomanuels/distrib_gp/2/1/10300/online/OEBPS/'
|
||||
r = requests.get(url)
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
pagelist = soup.find('nav', {'epub:type': 'page-list'})
|
||||
links = pagelist.find_all('a')
|
||||
|
||||
i = 1
|
||||
for link in links:
|
||||
lien = link.get('href')
|
||||
texte = link.text
|
||||
|
||||
r = requests.get(debut + lien)
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
div_element = soup.find('div', class_='page')
|
||||
style_attribute = div_element.get('style')
|
||||
|
||||
background_image_url_match = re.search(r'background-image:url\(\'(.*?)\'\)', style_attribute)
|
||||
|
||||
if background_image_url_match:
|
||||
background_image_url = background_image_url_match.group(1)
|
||||
parts = lien.split('/')[0]
|
||||
image_url = debut + parts + '/' + background_image_url
|
||||
|
||||
print('image_url: ', image_url)
|
||||
|
||||
getimg(image_url, i)
|
||||
else:
|
||||
print("Image d'arrière-plan non trouvée.")
|
||||
|
||||
i += 1
|
Loading…
x
Reference in New Issue
Block a user