Skip to content

Instantly share code, notes, and snippets.

@acagastya
Created September 10, 2018 19:16
Show Gist options
  • Save acagastya/1fc86c5887a3492ddb53a34239307387 to your computer and use it in GitHub Desktop.
Save acagastya/1fc86c5887a3492ddb53a34239307387 to your computer and use it in GitHub Desktop.
#!/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