0

I am trying to webscrape youtube data to obtain the views,likes,dislikes,etc. I am using pafy library to achieve the same. While I am able to get the other info , I am unable to fetch the likes and dislikes as it is returning None. I have attached the output for reference. In order to run the code just replace the API key with your developer API Key. The screenshot of the output is as below:

Output

Here is the code:

#!pip install pafy

#!pip install --upgrade youtube_dl

import pafy

url="http://www.youtube.com/watch?v=YBLF6ZqhO5I"

pafy.set_api_key("YOUR API KEY")

v= pafy.new(url)

print(v.title)

print(v.viewcount)

print(v.published)

print(v.likes)

#print(v.url)

  • Did you try using Beautiful soup way ? – Vin Jul 28 '20 at 14:15
  • Yes I did and it works too but I want to know why it's not working with pafy as one of the requirements that I have is achievable through pafy only. – shubhrika tyagi Jul 28 '20 at 17:18
  • Yeah you are right that's weird i also tried at my end but is not giving the actual count apart from NONE every time. – Vin Jul 29 '20 at 03:57

0 Answers0