CognitiveScience commited on
Commit
3242331
·
1 Parent(s): c49bc9d

Update ccogsphere.py

Browse files
Files changed (1) hide show
  1. ccogsphere.py +14 -8
ccogsphere.py CHANGED
@@ -2,19 +2,25 @@ from bs4 import BeautifulSoup
2
  import requests
3
 
4
  def ccs(inp):
5
- inp1=inp.split(":")[0]
6
- if (inp1=="https"):
7
  response = requests.get(inp)
8
  soup = BeautifulSoup(response.text, "html.parser")
9
  result=response.text[response.text.find("viewCount"):].split('"')[2]
10
  else:
11
- if(inp1=="End"):
12
- result=result + " The " + inp1
13
- else:
14
- if (inp1=="Start"):
15
- result="Start" + "\n"
16
  else:
17
- result+=inp1 + " Picked " + inp.split(":")[1] + "\n"
 
 
 
 
 
 
 
 
18
 
19
 
20
 
 
2
  import requests
3
 
4
  def ccs(inp):
5
+ inp1=inp.split(":")
6
+ if (inp1[0]=="https"):
7
  response = requests.get(inp)
8
  soup = BeautifulSoup(response.text, "html.parser")
9
  result=response.text[response.text.find("viewCount"):].split('"')[2]
10
  else:
11
+ if (len(inp)==2):
12
+ if(inp1[0]=="End"):
13
+ result=result + " The " + inp1
 
 
14
  else:
15
+ if (inp1[0]=="Start"):
16
+ result="Started" + "\n"
17
+ else:
18
+ try:
19
+ result+=inp1[0] + " Picked " + inp1[1] + "\n"
20
+ except NameError:
21
+ result=inp1[0] + " Picked " + inp1[1] + "\n"
22
+ else:
23
+ result="Wrong Format"
24
 
25
 
26