Get video ID from a YouTube playlist - c#

I need to get the Video Ids from a YouTube Playlist.
e.g.: Thats our demo playlist: http://www.youtube.com/playlist?list=PL8B03F998924DA45B
That's my c# code:
SyndicationFeed feed = await client.RetrieveFeedAsync("https://gdata.youtube.com/feeds/api/playlists/PL8B03F998924DA45B?v=2");
I then can not find the IDs of the single videos from the playlist in my feed object. Any Ideas?

I suggest you to use Data API v3. Data API is the one that reflects playlists in YouTube and highly supported.
In v3, you will do a playlistItems->list call with setting the playlistId.
In the response, if the playlist item is a video, you can get videoId from either snippet.resourceId.videoId or contentDetails.videoId
You can find C# examples here.

Related

C# - YouTube API v3, Get likes count

I'm trying to get likes count using Google API v3 in C#.
SearchResource.ListRequest listRequest = service.Search.List("snippet");
listRequest.Q = args;
listRequest.MaxResults = 5;
IList<SearchResult> searchListResponse = (await listRequest.ExecuteAsync()).Items;
But that only give me generic information (like video ID, snippet, etc...)
I found some similar questions like this one
Get comment or likes count for YouTube video using API 3.0
But they only tell how to do it using HTTP request and not using the .NET library
I tried adding the statistic keyword in the Search.List thing like that
service.Search.List("snippet,statistics");
But it return me a 400 error
Google.Apis.Requests.RequestError
snippet statistics [400]
Errors [
Message[snippet statistics] Location[part - parameter]
Reason[unknownPart] Domain[youtube.part]
]
So my question is how do I get likes count using Google API v3 in C# ?
I'm not familiar with .NET but I can tell you the likeCount is in statistics but that is not available through the Search endpoint. You must use the Videos endpoint and request statistics that way. Hopefully that will point you in the right direction.

Youtube V3 Data API

I would like to know a very simple way of getting the list of videos that were uploaded by user/or videos in a channel.
For example, I want to retrieve basic information about videos those were posted in the Youtube spotlight channel (http://www.youtube.com/user/YouTube/videos). All I need is read-only publicly available information.
I am so lost with the Youtube v2/v3 API / Google APIs etc. I could partially make one example work but I think all the examples are heavily biased towards "third-party" access. I started developing one example by looking at their samples and when I compiled and ran the application - it was asking me to sign-in to my google account.
Any help is greatly appreciated. Thanks.
For the sake of simplicity you can use the api v2 like this:
const string channelName = "YourChannel";
var URL =string.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads",
channelName);
using (var reader = new XmlTextReader(URL))
{
while (reader.Read())
{
if (reader.Name.Equals("media:player"))
{
string attribute = reader["url"];
if (attribute != null)
{
Response.Write("Youtube Video Link" + attribute + "<br />");
}
}
}
}
You can achieve similarly using v3 but It will require some more work

post items from to amazon.com using API

What API I should use to post items from asp.net (C#) web application to amazon.com ?
please guide me to proper documentation and steps.
What I am looking for is how to add new item into certain category and pass the item title/description/pictures/price etc... -- plz advice
Thanks
You're question is a bit vague, but this was the most useful link I found when researching into how to interface with Amazon using C# -
http://flyingpies.wordpress.com/2009/08/01/17/
You need the Marketplace Web Services API. Found at http://developer.amazonservices.com.
You then need the flat file feed specifications to send the flat file in the correct format to the MWS. That can be found after you're logged into your seller central account:
https://sellercentral.amazon.com/gp/help/help.html/ref=ag_13461_cont_help?ie=UTF8&itemID=13461&language=en_US
From there, you can simply send to the MWS the data you need. Here is a snippet of my code:
SubmitFeedRequest req = new SubmitFeedRequest();
req.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5(feedContent);
feedContent.Position = 0;
req.FeedContent = feedContent;
req.FeedType = "_POST_FLAT_FILE_INVLOADER_DATA_";
req.PurgeAndReplace = false;
req.Marketplace = MarketPlaceId;
req.Merchant = MerchantId;
return Service.SubmitFeed(req);
Assuming that by 'posting' you mean posting new items into the amazon marketplace, you can use
this api https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html
Also google works wonders for searching
It sounds to me like you need the Amazon Market Place Feeds API.
https://developer.amazonservices.co.uk/gp/mws/api.html?ie=UTF8&section=feeds&group=bde&version=latest
You can use SubmitFeed to send product and inventory information to Amazon

Get Photos From Album Facebook C#sdk

i want to get album photos so far i have been able to get album info
I am using facebook c# sdk 5.0 for dot net framework 4
code so far is dynamic friends = app.Get("me/albums");
this provides data and we can get everything mentioned here http://developers.facebook.com/docs/reference/api/album/
but i cannot establish connection mentioned for photos
so far i have been able to find this method if there is a good or different approach then please let me know.
//Get the album data
dynamic albums = app.Get("me/albums");
foreach(dynamic albumInfo in albums.data)
{
//Get the Pictures inside the album this gives JASON objects list that has photo attributes
// described here http://developers.facebook.com/docs/reference/api/photo/
dynamic albumsPhotos = app.Get(albumInfo.id +"/photos");
}

Get all photos from Picasa by person

Is it possible to get all photos by a persons name through the Picasa Web Albums Data API?
All examples I can find, shows how to get photos by an albumid.
You can request a list of the most recent photos, with a very high value for max-results.
I'm not sure if you are using the .NET API Client Library, but if so, an example is here:
http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_dotnet.html#ListRecentPhotos
Use query.NumberToRetrieve to set the value for max-results.
If you are not using the .NET Client Library, an example using HTTP protocol can be found here:
http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_protocol.html#ListRecentPhotos
You can retrieve facial recognition data from the Picasa Web API through a (currently) undocumented API URL that is used by the Picasa desktop application. More info here:
http://klick.com/pharma/blog/2011/09/retrieving-face-tag-data-from-the-picasa-web-api/
by setting "default" that mean retrieving current user with that code you can retrive the user photos in specific album
PhotoQuery query = new PhotoQuery(PicasaQuery.CreatePicasaUri("default", albumId));
PicasaFeed feed = picasaService.Query(query);
foreach (var entry in feed.Entries)
{
PhotoAccessor photoAccessor = new PhotoAccessor((PicasaEntry)entry);
Photo photo = new Photo();
photo.Title = photoAccessor.PhotoTitle;
photo.Summary = photoAccessor.PhotoSummary;
photo.MediaUri = entry.Content.AbsoluteUri;
photo.Id = photoAccessor.Id;
photo.AlbumId = photoAccessor.AlbumId;
photos.Add(photo);
}
If you know the subjectid then using an RSS link you can get a feed of ALL images for that user regardless of albums. The link is:
http://picasaweb.google.com/data/feed/base/user/PICASA_USERNAME?alt=rss&kind=photo&subjectids=SOME_BIG_LONG_STRING_OF_CHARACTERS
Also, you can find the subjectids by going to each person on PWA and clicking the RSS link at the bottom of the page.
I am stil trying to find a way to get all subjectids without a manual lookup.
Source: http://credentiality2.blogspot.com/2010/02/picasa-gdata-api-and-face-recognition.html

Categories

Resources