Hallo,
Ich will langsam versuchen in das Thema Youtube einzusteigen und will einen Liker usw programieren.
Leider krige ich noch nicht mal VideoInfos ausgelesen.
Die daten oben habe ich natürlich in mein Project richtig eigetragen.
An der MAkierten Stelle (<-Makierte Stelle :D) kommt dieser ERROR
kann mir da wer helfen
(Code aus -> [Only registered and activated users can see links. Click Here To Register...])
Ich will langsam versuchen in das Thema Youtube einzusteigen und will einen Liker usw programieren.
Leider krige ich noch nicht mal VideoInfos ausgelesen.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.YouTube;
using Google.GData.Extensions.MediaRss;
using Google.YouTube;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
YouTubeRequestSettings settings = new YouTubeRequestSettings("PrivateTool", "Mein Developer Key", "Username", "PW");
YouTubeRequest request = new YouTubeRequest(settings);
string videoId = "f9CZgT3sN68";
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + videoId);
Video video = request.Retrieve<Video>(videoEntryUrl); //<- Makierte Stelle :D
printVideoEntry(video);
Console.ReadLine();
}
static void printVideoEntry(Video video)
{
Console.WriteLine("Title: " + video.Title);
Console.WriteLine(video.Description);
Console.WriteLine("Keywords: " + video.Keywords);
Console.WriteLine("Uploaded by: " + video.Uploader);
if (video.YouTubeEntry.Location != null)
{
Console.WriteLine("Latitude: " + video.YouTubeEntry.Location.Latitude);
Console.WriteLine("Longitude: " + video.YouTubeEntry.Location.Longitude);
}
if (video.Media != null && video.Media.Rating != null)
{
Console.WriteLine("Restricted in: " + video.Media.Rating.Country);
}
if (video.IsDraft)
{
Console.WriteLine("Video is not live.");
string stateName = video.Status.Name;
if (stateName == "processing")
{
Console.WriteLine("Video is still being processed.");
}
else if (stateName == "rejected")
{
Console.Write("Video has been rejected because: ");
Console.WriteLine(video.Status.Value);
Console.Write("For help visit: ");
Console.WriteLine(video.Status.Help);
}
else if (stateName == "failed")
{
Console.Write("Video failed uploading because:");
Console.WriteLine(video.Status.Value);
Console.Write("For help visit: ");
Console.WriteLine(video.Status.Help);
}
if (video.ReadOnly == false)
{
Console.WriteLine("Video is editable by the current user.");
}
if (video.RatingAverage != -1)
{
Console.WriteLine("Average rating: " + video.RatingAverage);
}
if (video.ViewCount != -1)
{
Console.WriteLine("View count: " + video.ViewCount);
}
Console.WriteLine("Thumbnails:");
foreach (MediaThumbnail thumbnail in video.Thumbnails)
{
Console.WriteLine("\tThumbnail URL: " + thumbnail.Url);
Console.WriteLine("\tThumbnail time index: " + thumbnail.Time);
}
Console.WriteLine("Media:");
foreach (Google.GData.YouTube.MediaContent mediaContent in video.Contents)
{
Console.WriteLine("\tMedia Location: " + mediaContent.Url);
Console.WriteLine("\tMedia Type: " + mediaContent.Format);
Console.WriteLine("\tDuration: " + mediaContent.Duration);
}
}
}
}
}
Die daten oben habe ich natürlich in mein Project richtig eigetragen.
An der MAkierten Stelle (<-Makierte Stelle :D) kommt dieser ERROR
Code:
Execution of request failed: http://gdata.youtube.com/feeds/api/videos/f9CZgT3sN68
(Code aus -> [Only registered and activated users can see links. Click Here To Register...])