@@ -29,9 +29,11 @@ def get_video_info(url):
2929result ["tags" ]= ', ' .join ([meta .attrs .get ("content" )for meta in soup .find_all ("meta" , {"property" :"og:video:tag" }) ])
3030# number of likes
3131text_yt_formatted_strings = soup .find_all ("yt-formatted-string" , {"id" :"text" ,"class" :"ytd-toggle-button-renderer" })
32- result ["likes" ]= int ('' .join ([c for c in text_yt_formatted_strings [0 ].attrs .get ("aria-label" )if c .isdigit () ]))
32+ result ["likes" ]= '' .join ([c for c in text_yt_formatted_strings [0 ].attrs .get ("aria-label" )if c .isdigit () ])
33+ result ["likes" ]= 0 if result ['likes' ]== '' else int (result ['likes' ])
3334# number of dislikes
34- result ["dislikes" ]= int ('' .join ([c for c in text_yt_formatted_strings [1 ].attrs .get ("aria-label" )if c .isdigit () ]))
35+ result ["dislikes" ]= '' .join ([c for c in text_yt_formatted_strings [1 ].attrs .get ("aria-label" )if c .isdigit () ])
36+ result ['dislikes' ]= 0 if result ['dislikes' ]== '' else int (result ['dislikes' ])
3537
3638# channel details
3739channel_tag = soup .find ("yt-formatted-string" , {"class" :"ytd-channel-name" }).find ("a" )
@@ -66,4 +68,4 @@ def get_video_info(url):
6668print (f"\n Description:{ data ['description' ]} \n " )
6769print (f"\n Channel Name:{ data ['channel' ]['name' ]} " )
6870print (f"Channel URL:{ data ['channel' ]['url' ]} " )
69- print (f"Channel Subscribers:{ data ['channel' ]['subscribers' ]} " )
71+ print (f"Channel Subscribers:{ data ['channel' ]['subscribers' ]} " )