CogSphere / ccogsphere.py
CognitiveScience's picture
Update ccogsphere.py
3242331
raw
history blame
802 Bytes
from bs4 import BeautifulSoup
import requests
def ccs(inp):
inp1=inp.split(":")
if (inp1[0]=="https"):
response = requests.get(inp)
soup = BeautifulSoup(response.text, "html.parser")
result=response.text[response.text.find("viewCount"):].split('"')[2]
else:
if (len(inp)==2):
if(inp1[0]=="End"):
result=result + " The " + inp1
else:
if (inp1[0]=="Start"):
result="Started" + "\n"
else:
try:
result+=inp1[0] + " Picked " + inp1[1] + "\n"
except NameError:
result=inp1[0] + " Picked " + inp1[1] + "\n"
else:
result="Wrong Format"
return result