File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,12 +37,12 @@ def get_video_description(video_id, key):
3737
3838 length = isodate .parse_duration (content_details ['duration' ])
3939 out += ' - length \x02 {}\x02 ' .format (timeformat .format_time (int (length .total_seconds ()), simple = True ))
40+ totalvotes = float (statistics ['likeCount' ]) + float (statistics ['dislikeCount' ])
4041
41- if 'likeCount' in statistics :
42+ if totalvotes != 0 :
4243 # format
4344 likes = pluralize (int (statistics ['likeCount' ]), "like" )
4445 dislikes = pluralize (int (statistics ['dislikeCount' ]), "dislike" )
45- totalvotes = float (statistics ['likeCount' ]) + float (statistics ['dislikeCount' ])
4646
4747 percent = 100 * float (statistics ['likeCount' ]) / totalvotes
4848 out += ' - {}, {} (\x02 {:.1f}\x02 %)' .format (likes ,
@@ -145,5 +145,6 @@ def ytplaylist_url(match):
145145
146146 title = snippet ['title' ]
147147 author = snippet ['channelTitle' ]
148- num_videos = str (content_details ['itemCount' ])
149- return "\x02 {}\x02 - \x02 {}\x02 videos - \x02 {}\x02 " .format (title , num_videos , author )
148+ num_videos = int (content_details ['itemCount' ])
149+ count_videos = ' - \x02 {:,}\x02 video{}' .format (num_videos , "s" [num_videos == 1 :])
150+ return "\x02 {}\x02 {} - \x02 {}\x02 " .format (title , count_videos , author )
You can’t perform that action at this time.
0 commit comments