Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8b3590355 | ||
| cf8ec8b07e | |||
|
d74b94b769
|
|||
|
|
2d08c2959a | ||
| 5da3050da6 | |||
|
|
e681c8ba92 | ||
| 3a6da75c8f | |||
| 5c8ffb45c0 |
@@ -54,7 +54,7 @@ jobs:
|
||||
uses: https://github.com/mikepenz/release-changelog-builder-action@v5
|
||||
with:
|
||||
platform: "gitea"
|
||||
baseURL: "http://gitea:3000"
|
||||
baseURL: "http://192.168.178.110:3000"
|
||||
configuration: ".gitea/changelog_config.json"
|
||||
|
||||
env:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "bibapi"
|
||||
version = "0.1.0"
|
||||
version = "0.0.5"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
authors = [
|
||||
@@ -20,7 +20,7 @@ requires = ["uv_build >= 0.9.5, <0.10.0"]
|
||||
build-backend = "uv_build"
|
||||
|
||||
[tool.bumpversion]
|
||||
current_version = "0.0.2"
|
||||
current_version = "0.0.5"
|
||||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||
serialize = ["{major}.{minor}.{patch}"]
|
||||
search = "{current_version}"
|
||||
|
||||
@@ -4,6 +4,8 @@ import regex
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from .schemas.bookdata import BookData as Book
|
||||
|
||||
URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?type0%5B%5D=allfields&lookfor0%5B%5D={}&join=AND&bool0%5B%5D=AND&type0%5B%5D=au&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ti&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ct&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=isn&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ta&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=co&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=py&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pp&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pu&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=si&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=zr&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=cc&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND"
|
||||
BASE = "https://rds.ibs-bw.de"
|
||||
|
||||
@@ -156,6 +158,46 @@ class Catalogue:
|
||||
edition=edition,
|
||||
)
|
||||
|
||||
def get_book_with_data(self, searchterm: str) -> Book | None:
|
||||
book = self.get_book(searchterm)
|
||||
if book:
|
||||
# request data from book.link and parse for additional data
|
||||
result = self.search(book.link)
|
||||
soup = BeautifulSoup(result, "html.parser")
|
||||
|
||||
# from div col-xs-12 rds-dl RDS_SIGNATURE get signature (second div in this div)
|
||||
signature = None
|
||||
signature_el = soup.find("div", class_="RDS_SIGNATURE")
|
||||
print(signature_el)
|
||||
if signature_el:
|
||||
signature = signature_el.find("div", class_="rds-dl-panel").get_text(
|
||||
strip=True
|
||||
)
|
||||
print(signature)
|
||||
book.signature = signature
|
||||
# from div col-xs-12 col-md-5 col-lg-4 rds-dl-head RDS_ISBN get isbn (second div in this div)
|
||||
isbn = None
|
||||
isbn_el = soup.find("div", class_="RDS_ISBN")
|
||||
if isbn_el:
|
||||
isbn = isbn_el.find_next_sibling(
|
||||
"div", class_="col-xs-12 col-md-7 col-lg-8 rds-dl-panel"
|
||||
).get_text(strip=True)
|
||||
book.isbn = isbn
|
||||
# from div col-xs-12 col-md-5 col-lg-4 rds-dl-head RDS_SCOPE get pages (second div in this div)
|
||||
pages = None
|
||||
pages_el = soup.find("div", class_="RDS_SCOPE")
|
||||
if pages_el:
|
||||
pages = pages_el.find_next_sibling(
|
||||
"div", class_="col-xs-12 col-md-7 col-lg-8 rds-dl-panel"
|
||||
).get_text(strip=True)
|
||||
# regex match to get pages by grabbing the first number in the string
|
||||
match = regex.search(r"(\d+)", pages)
|
||||
if match:
|
||||
pages = match.group(1)
|
||||
book.pages = pages
|
||||
return book
|
||||
return None
|
||||
|
||||
def get(self, ppn: str) -> Book | None:
|
||||
# based on PPN, get title, people, edition, year, language, pages, isbn,
|
||||
link = f"https://rds.ibs-bw.de/phfreiburg/opac/RDSIndexrecord/{ppn}"
|
||||
|
||||
Reference in New Issue
Block a user