ব্যবহারকারী:BoipediaBot
অবয়ব
টেমপ্লেট:বট import requests from bs4 import BeautifulSoup
url = "https://www.rokomari.com/book/12345"
headers = {
"User-Agent": "Mozilla/5.0"
}
response = requests.get(url, headers=headers) soup = BeautifulSoup(response.text, "html.parser")
title = soup.find("h1").text.strip() author = soup.find("a", class_="author-name").text.strip()
info = soup.find_all("div", class_="book-information")
publisher = "" publish_year = ""
for i in info:
text = i.text
if "প্রকাশনী" in text:
publisher = text.replace("প্রকাশনী:", "").strip()
if "প্রকাশকাল" in text:
publish_year = text.replace("প্রকাশকাল:", "").strip()
wiki_text = f""" { নাম = {title} }
{title} একটি বাংলা বই। এটি {author} রচিত এবং {publisher} থেকে প্রকাশিত। """
print(wiki_text)