Spaces:
Runtime error
Runtime error
Commit
·
d8a07a3
1
Parent(s):
fa6ddf9
Rename youtube1.py to bcogsphere.py
Browse files- youtube1.py → bcogsphere.py +10 -8
youtube1.py → bcogsphere.py
RENAMED
@@ -8,22 +8,24 @@ import requests
|
|
8 |
#class myCelSci(Model):
|
9 |
# pass
|
10 |
|
11 |
-
def
|
12 |
HEADER = {"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
|
13 |
#link = "https://youtu.be/vQUCSHUlN-k?si=FfIsODGjJDzIHOAS"
|
14 |
-
|
15 |
-
soup = BeautifulSoup(
|
16 |
#print (soup.prettify())
|
17 |
|
18 |
titleSoupMeta = soup.find("meta", property="og:title")
|
19 |
videoTitle = titleSoupMeta["content"] if titleSoupMeta else "NotFound"
|
20 |
-
|
21 |
-
|
|
|
22 |
|
23 |
#soup=soup.prettify()
|
24 |
#viewSoupMeta = [line for line in soup.split('viewCount') if "views" in line]
|
25 |
|
26 |
-
response2=
|
|
|
27 |
# Store JSON data in API_Data
|
28 |
#for key in API_Data:{
|
29 |
# print(key,":", API_Data[key])
|
@@ -40,6 +42,6 @@ def getviews(link): #add source? and for sentsummary: https://huggingface.co/the
|
|
40 |
|
41 |
#celsci1=myCelSci()
|
42 |
|
43 |
-
response3=
|
44 |
|
45 |
-
return
|
|
|
8 |
#class myCelSci(Model):
|
9 |
# pass
|
10 |
|
11 |
+
def bcf(link): #add source? and for sentsummary: https://huggingface.co/themanas021
|
12 |
HEADER = {"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
|
13 |
#link = "https://youtu.be/vQUCSHUlN-k?si=FfIsODGjJDzIHOAS"
|
14 |
+
bcfresponse = requests.get(link) #, headers=HEADER)
|
15 |
+
soup = BeautifulSoup(bcfresponse.text, "html.parser")
|
16 |
#print (soup.prettify())
|
17 |
|
18 |
titleSoupMeta = soup.find("meta", property="og:title")
|
19 |
videoTitle = titleSoupMeta["content"] if titleSoupMeta else "NotFound"
|
20 |
+
|
21 |
+
bcfresult = {}
|
22 |
+
bcfresult["views"] = soup.find("meta", itemprop="interactionCount")['content']
|
23 |
|
24 |
#soup=soup.prettify()
|
25 |
#viewSoupMeta = [line for line in soup.split('viewCount') if "views" in line]
|
26 |
|
27 |
+
#response2=bcfresult.text[bcfresponse.text.find("viewCount"):].split('"')[2]
|
28 |
+
|
29 |
# Store JSON data in API_Data
|
30 |
#for key in API_Data:{
|
31 |
# print(key,":", API_Data[key])
|
|
|
42 |
|
43 |
#celsci1=myCelSci()
|
44 |
|
45 |
+
#response3= bcfresponse #celsci1.ax1 #celsci1.fame(300) #checkfame("dd")
|
46 |
|
47 |
+
return bcfresult #result #soup.prettify()
|