Youtube Api no result issue - google-api

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.

Related

Is it possible to get Google Analytic goal value by date?

Google Analytics Management API goals endpoint. this is the link showing the goal endpoint I will be using to get a value. Is it possible for me to get the goal value broken up by date? I want to know the goal value for each day so I can create a line graph with accurate data. This endpoint is apart of the management API, but I know the core reporting API is more flexible with sorting by date. I would like to know if it is possible. If it is, please enlighten me!
Any reason you can't use the reporting API? You can use dimension=ga:date and metrics=ga:goalXXCompletions (ga:goal1Completions).
See the link to the query explorer report below:
https://ga-dev-tools.appspot.com/query-explorer/?start-date=2016-01-01&end-date=2016-03-27&metrics=ga%3Agoal1Completions&dimensions=ga%3Adate&samplingLevel=HIGHER_PRECISION&max-results=10000
You can query them together.
# get report data
query.list <- Init(start.date = "XXXXXX",
end.date = "XXXXXX",
dimensions = "ga:date",
metrics = "ga:goalXXValue",
table.id = "ga:XXXXX")

facebook userid from username in excel power query

I have been spending time on excel power query in the past two days but did not figure out how to fetch facebook userid if i have the username.
For instance, if I have the username zuck OR
the profile url https://www.facebook.com/zuck
using any of the above, is it possible to find the uid (facebook numeric id). In this example, the ID is 4
Somewhat similar to what http://findmyfbid.com does, I want to find out if it is possible with excel power query.
Thanks
Looking around the Power Query Facebook connector and the Facebook Graph API reference I can't find any obvious way to look up user id's from the username.
http://findmyfbid.com/failure indicates that a search engine had to index the public usernames in order to find the id. You can open a page like https://www.facebook.com/Code.org/ in your browser and muck through the HTML and find the username yourself, assuming the page is still public.
On the other hand, findmyfbid.com has already solved this problem. Here's how to query against their website directly using a custom Power Query function FindId:
let
// Assume you've already URL-encoded the id
FindId = (id as text) as text =>
let
Source = Web.Contents("http://findmyfbid.com/", [
Content = Text.ToBinary("url=" & id),
Headers = [#"Content-Type"= "application/x-www-form-urlencoded"]
]),
// Web.Page can't POST directly, so force Web.Contents to execute the POST
WebPage = Web.Page(Binary.Buffer(Source)),
// Hopefully findmyfbid.com doesn't change their HTML layout
DrillDown = WebPage[Data]{0}
{[Name="HTML"]}[Children]
{[Name="BODY"]}[Children]
{[Name="DIV"]}[Children]
{[Name="DIV"]}[Children]
{[Name="CODE"]}[Children]
{[Kind="Text"]}[Text]
in
DrillDown,
ExampleCodeOrg = FindId("code.org")
in
ExampleCodeOrg
And you find that Code.org has an Id of 309754825787494.

Get all members from the mailing list using MailChimp API 3.0

http://kb.mailchimp.com/api/resources/lists/members/lists-members-collection
Using this resource we can obtain only first 10 members. How to get all?
The answer is quite simple - use offset and count parameters in URL query:
https://us10.api.mailchimp.com/3.0/lists/b5b5fdc2fa/members?offset=150&count=10
Finally I found PHP API client for MailChimp API v3:
https://github.com/pacely/mailchimp-api-v3
And official docs about pagination.. I missed it before :(
http://kb.mailchimp.com/api/article/api-3-overview
I stumbled on this one while researching a way to get all list members in MC API 3.0 as well. I noticed that there were some comments on the API timing out when trying to get all list members on one page. I also encountered this at first but was able to overcome it by limiting the fields in the result by using the 'fields' param. My code is for a mass deleter so all I really needed was the ID of each member to put together a batch delete request. Here's how my fetch request looks (psuedo-code):
$total_members = $result['total_items'];//get number of members in list via previous request
https://usXX.api.mailchimp.com/3.0/lists/foobarx/members?fields=members.id&count=total_members
This way I'm able to fetch over 15,000 subscribers on one page without error.
offset and count is the official way on the docs, but the problem is that has linear slowdown. It appears to be an n^2 solution, so if you have 20,000 items, you're in trouble. Their docs http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#read-get_lists_list_id_members warn you against using offset.
If you're scenario permits you to use other filters (like since_last_changed), then you can do it quickly. See What is the right syntax for "timeframe" in MailChimp API 3.0 for format for datetime.
Using offset and count parameters are correct as mentioned in some of the other answers, but becomes tedious for large lists.
A more efficient way, is to use a client for the MailChimp API. I used mailchimp3 for python. Using this, it's pretty easy to get all members on your list because it handles the pagination. Here's how you would do it.
from mailchimp3 import MailChimp
client = MailChimp('YOUR_USERNAME', 'YOUR_SECRET_KEY')
client.lists.members.all('YOUR_LIST_ID', get_all=True, fields="members.email_address")
You can do it just with count, making an API call to the list root so in the next API call you include the count parameter and you have all your list members.
I ran into issues with this because I had a moderate list with 2600 members and MailChimp was throwing an error, but it worked with 1500 people.
So for a list bigger than 1500 members I use MailChimp export API bare in mind that this is going to get discontinued but I could not find any other acceptable solutions.
Alternatively for bigger lists (>1500) you could get the total of members and then make multiple api calls to the Member endpoint but I really dislike that :(
If anyone has a better alternative I would be really glad to hear it.
With MailChimp.Net.
Use the offset value.
List<Member> listMembers = new List<Member>();
IMailChimpManager manager = new MailChimpManager(MailChimpApiKey);
bool moreAvailable = true;
int offset = 0;
while (moreAvailable)
{
var listMembers = manager.Members.GetAllAsync(yourListId, new MemberRequest
{
Status = Status.Subscribed,
Limit = 250,
Offset = offset
}).ConfigureAwait(false);
var Allmembers = listMembers.GetAwaiter().GetResult();
foreach(Member member in Allmembers)
{
listMembers.Add(member);
}
if (Allmembers.Count() == 250)
//if the count is < of 250 then it means that there aren't more results
offset += 250;
else
moreAvailable = false;
}

how to get the fan page name of Facebook wall post?

I am reading the wall posts of fan pages under my FB account using C# SDK. I would like to know the page id of the wall post. Is there any property in C# SDK?
As people start to use the Graph objects more an more, the FQL seems to be fading. But FQL is not deprecated (at least not yet).
For a particular wall post you're reading via your C# SDK, simply FQL it:
SELECT source_id FROM stream WHERE post_id = {post_id}
For more information https://developers.facebook.com/docs/reference/fql/stream/
For information on how to make an FQL query run in the C# SDK, see:
http://blog.prabir.me/post/Facebook-CSharp-SDK-Making-Requests.aspx
But it's going to look something like this
var client = new FacebookClient(access_token);
// this is where you already grab your post, so you have post_id
var data = client.query("SELECT source_id FROM stream WHERE post_id =" + post_id);

reading RSS returns different response on localhost

im trying to parse an rss feed on localhost, and it brings back the right results, but when i try to do that from another (preproduction server) and live, it returns a list of comments made by users on the hydrapinion website which is completely unrelated, have i been spoofed? how can i debug this? its just an rss feed and a simple LINQ code!
string bingurl = "http://www.bing.com/search?form=QBRE&filt=rf&qs=n&format=rss&count=10&q=+environment+(site:www.australianit.news.com.au)";
XDocument doc = XDocument.Load(bingurl);
IEnumerable<XElement> items = (from i in doc.Descendants("item")
orderby DateTime.Parse(i.Element("pubDate").Value) descending
select i).Take(10);
rpData.DataSource = items;
rpData.DataBind();
i tried a different combination, and i get no results at all! do u think the server settings have antyhing to do with retrieving rss results?
i found some decent guide for bing search, but as it turned out, bing doesnt bring decent resuls! and it appears to me it changes the results set according to where ur calling it from, i tried adding "loc:" to the rss, when called from code it returned different results than when called on bing website itself, i dont know the algorithm they are using but it is getting more obvious
the guide is here:
http://help.live.com/help.aspx?mkt=en-AU&project=a

Resources