Last active
May 6, 2025 09:13
-
-
Save terremoth/d411f2dfffd3fc74f267f28392279607 to your computer and use it in GitHub Desktop.
Pega um versículo aleatório da Bíblia (em PT-BR) e printa no terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import get | |
MAIN_URL = "https://onbibles.com/api/verses/random?bibleSlug=acf" | |
HEADERS = ({ | |
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.2403.157 ' | |
'Safari/537.36', 'Accept-Language': 'pt-BR, en;q=0.5'}) | |
page = get(MAIN_URL, headers=HEADERS) | |
if page.status_code != 200: | |
print("Erro: Não foi possível estabelecer uma conexão com o site BibliaOnline.") | |
exit(1) | |
json_obj = page.json() | |
book = json_obj["item"]["bible"]["book"] | |
book_name = book["name"] | |
chapter = book["chapter"] | |
chapter_number = chapter["number"] | |
verses = chapter["verses"][0] | |
verse = verses["number"] | |
content = verses["text"] | |
print(f"{content}\n{book_name} {chapter_number}:{verse}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment