Reputation: 4296
In former times I used
http://gdata.youtube.com/feeds/api/users/USERNAME?v=2&alt=json
to get the number of subscribers for certain users. A month ago Google disabled that old API. Is there an alternative now which doesn't make use of an API_KEY?
Upvotes: 1
Views: 1059
Reputation: 2372
You could try using subscriptions.list to get the list of subs via the API explorer. See the mySubscribers
field.
Upvotes: 0
Reputation: 1207
If you like a very ugly solution ( or you may work on it ), you can use YQL.
replace url
with the one you have
https://query.yahooapis.com/v1/public/yql?q=select div from html where url="https://www.youtube.com/user/Computerphile"&format=json&diagnostics=true&callback=
and then fetch number of subscriber from the json string
example in python
>>> import requests
>>> import json
>>> r = requests.get('https://query.yahooapis.com/v1/public/yql?q=select div from html where url="https://www.youtube.com/user/Computerphile"&format=json&diagnostics=true&callback=')
>>> res = json.loads(r.text)
>>> res ["query"]["results"]["body"][3]["div"]["div"][3]["div"]["div"][4]["div"]["div"][0]["div"]["div"][1]["div"]["span"]["span"][0]["content"]
u'409,045'
You can use regex:
>>> re.findall('"content":"(\d+(,\d*)*?)"',r.text)
[(u'409,045', u',045')]
and then extraxt the first group.
Upvotes: 1