-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYoutubeVideo.py
37 lines (32 loc) · 1.05 KB
/
YoutubeVideo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''
Nicholas Lin
video.py
4/2/20
'''
class YoutubeVideo:
title = ""
channel = ""
#date = ""
#description = ""
#comments = []
num_views = 0
def __init__(self, video_soup = ""):
if(video_soup != ""):
#Set title
self.title = video_soup.find('h1', {'class':'title'}).text
#Set channel
channel_html = video_soup.find('div', {'class':'ytd-channel-name'})
if(channel_html != None):
self.channel = channel_html.find('a').text
'''
#Set date
date_html = video_soup.find('div', {'id':'date'})
if(date_html != None):
self.date = date_html.find('yt-formatted-string').text
#Set description
description_html = video_soup.find('div', {'id':'description'})
self.description = description_html.text
#Set num_views
views_html = video_soup.find('span', {'class' : 'view-count'})
self.num_views = views_html.text
'''