I am working on a sheet to get the Subscriber Count of a Youtube Channel. The problem is the old paths are not working anymore and the new one does not seem to return anything.
Here is what I have tried:
"http://www.youtube.com/weargenius","//*[#id=\"c4-primary-header-contents\"]/div/div/div[2]/div/span/span[1]"
=IMPORTXML(I4,"//yt-formatted-string")
=IMPORTXML(I4,"//div[#class='style-scope ytd-c4-tabbed-header-renderer']")
=VALUE(INDEX(REGEXEXTRACT(LOWER(INDEX(REGEXEXTRACT(INDEX(IMPORTXML(A1,”//div[#class=’primary-header-actions’]”),1,1),”(Unsubscribe)([0-9kmKM.]+)”),1,2)),”([0-9,.]+)([km]?)”),,1) * SWITCH(INDEX(REGEXEXTRACT(LOWER(INDEX(REGEXEXTRACT(INDEX(IMPORTXML(A1,”//div[#class=’primary-header-actions’]”),1,1),”(Unsubscribe)([0-9kmKM.]+)”),1,2)),”([0-9,.]+)([km]?)”),,2),”k”,1000,”m”,1000000,1))
and many more solutions that did not work.
What I would like to accomplish is that we can get the subscriber account using google sheets from youtube profile page.
Use :
=IMPORTXML(I4;"//span[contains(#class,'subscriber')]")
try:
=IFERROR(MID(QUERY(IMPORTXML("https://www.youtube.com/channel/"&A1,
"//div[#class='primary-header-actions']"), "select Col1"), 31, 20), )
=IFERROR(MID(QUERY(IMPORTXML("https://www.youtube.com/channel/UCH58d6dGp6b0hisvkCh7sNg",
"//div[#class='primary-header-actions']"), "select Col1"), 31, 20), )
https://stackoverflow.com/a/55064665/5632629
Related
I'm trying to use Youtube Api V3 to get documentaries videos, unfortunately I can't get any results for many searched keys.
Is there any advanced configuration I can use to get more results or is there any alternative API(s) ?
this is my query
https://www.googleapis.com/youtube/v3/search?part=snippet&q=alien&type=video&videoCategoryId=35
First and foremost make sure you have an API_KEY. Follow link for details, then go to developer console to get one.
Then your request URL should look like this.
var API_KEY = "your api key";
var channelID = "The channel id u wan to pull";
var result = 30 // Limit the number of videos
`https://www.googleapis.com/youtube/v3/search?key=${API_KEY}&channelId=${channelID}&part=snippet,id&order=date&maxResults=${result}`
With an API key, I also pulled 0 results for 'alien' in the Documentary category. Perhaps there aren't any.
I am using ruby koala facebook graph API gem to retrieve events but cant restrict the events using a date range. I seem to be getting all events (even ones which have happened). What I am trying to do is get events is the next 200 days. I am using the following (ruby) code:
Koala.config.api_version = 'v2.10'
oauth = Koala::Facebook::OAuth.new app_id, app_secret
graph = Koala::Facebook::API.new oauth.get_app_access_token
from_date = Date.today
to_date = from_date + 200
fb_events = graph.get_object( fb_venue["url_listings"] + "?time_range={\"since\":#{from_date}, \"until\":#{to_date}" )
I am then getting the events 25 at once (the facebook default limit) using 'fb_events.next_page' to get them all.
I seem to get getting all events, including ones is the past.
Are you sure that the #get_object method wants a query string like that? Based on the docs[1], it seems that you should pass your object ID (which I assume is in fb_venue['url_listings'] for you as a first arg, and then metadata in a subsequent arg as a Hash. So I'd try something like:
fb_events = graph.get_object(fb_venue['url_listings'],
{since: from_date, until: to_date})
...according to the key/nesting structure FB expects.
Edit: forgot link to docs.
[1] -
http://www.rubydoc.info/github/arsduo/koala/Koala%2FFacebook%2FGraphAPIMethods%3Aget_object
According to the doc I don't think that you can request all the events, You can only select an event by using /{event-id} like this example or you can get user's events but you will need to ask him for the permission according to
permissions.
add user_events to the list of scope that you are permitting from user.
By this when user sign up using Facebook to your application it will take a permission for his events.
After that by using graph.get_object({facebook-user-id} + '/events') you will get 25 of his events as a default value and you can add {limit: 5} as a second parameter to the get_object function, You can use until and since but they should be in A Unix timestamp look at this to see the needed date format, hope this would help.
I want to get a list of events from a venues facebook page. There is code to configure koala at https://github.com/arsduo/koala. I setup a facebook App in Facebook and have app_id and app_secret but after much googleing cant work out where to get 'access_token = MY_TOKEN' or 'app_access_token = MY_APP_ACCESS_TOKEN'.
Ive looked at the Graph API Explorer (https://developers.facebook.com/tools/explorer) but cant seem to work out how to do it. For example one of the events pages is at https://www.facebook.com/pg/The-Old-England-186748738025516/events/?ref=page_internal.
Also example code on how to get the list would be great but the above world be a great start.
Found answer, it was very simple:
Koala.config.api_version = 'v2.10'
oauth = Koala::Facebook::OAuth.new 'my_id', 'my_secret'
graph = Koala::Facebook::API.new oauth.get_app_access_token
fb_events = graph.get_object( '186748738025516/events' )
I am working on an Android App. I want to get list of all restaurant around me within a specified radius(let say 5 miles). I tried using Google places API and it works, however it limits the number results returned to 20, what if there are more than 20 restaurant in that radius around me. How do I get an exhaustive list of all the restaurants? What is the best way to do this? Is there something other than Google Places API that I can use? Thanks for your help in advance.
If you want to do it server side you can use this guy's class :
http://andrenosalsky.com/blog/2011/google-places-api-php-class/
and you have to get an api key as it is explaned here :
http://code.google.com/intl/fr/apis/maps/documentation/places/
then you can send data in JSON format to your Android
I need to get user, channel & video insight data (views, ratings, subscribers etc) from youtube using ruby.
which tool/gem/framework to use:
I know this is asked before, but this is specific to my problem, I dont want to upload videos etc, most of the frameworks seem geared to this.
None of these seem to be a great fit to me, am I better off using httparty and rolling my own?
youtube-model - http://github.com/edgarjs/youtube-model/tree/master
youtube-g - http://github.com/tmm1/youtube-g
gdata on rails - http://code.google.com/apis/gdata/articles/gdata_on_rails.html
which api to use?
Should I use this api: http://code.google.com/apis/youtube/2.0/developers_guide_protocol_insight.html
I need a list of videos before I can call this, also I need to figure out what channel the user has, ideally get insight data at the channel level, if not I can aggregate it.
Or are feeds: http://code.google.com/apis/youtube/2.0/developers_guide_protocol_understanding_video_feeds.html
a better way to get this kind of data.
I spent some time working on this over the weekend. Youtube-Model seems to work the best:
Use example in youtube model to get authsub token
yt = YouTubeAccess.uploaded_by_user(token)
yt_videos = yt.videos
yt_videos.each{|video|
view_count = video.statistics.viewCount.to_i
favorite_count = video.statistics.favoriteCount.to_i
comment_count = video.comments.attributes['feedLink'].countHint.to_i
}
Not sure how to do channels, but this is a good start.