Created
September 10, 2018 19:16
-
-
Save acagastya/1fc86c5887a3492ddb53a34239307387 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python3 | |
from bs4 import BeautifulSoup as bsp | |
import requests | |
import sys | |
url = "https://quran.com/" + str(sys.argv[1]).replace(":", "/") | |
page = requests.get(url) | |
if page.status_code == 404: | |
print("Verse not found.") | |
sys.exit(0) | |
if page.status_code is not 200: | |
printf(page.status_code) | |
sys.exit(0) | |
soup = bsp(page.text, "lxml") | |
verse = soup.find("small", {"class": "english"}) | |
for v in verse: | |
print(v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment