This project is read-only.

Using LastfmNet

Initializing API

Lastfm lastfmApi = new Lastfm("LASTFM_API_KEY", "LASTFM_API_SECRET");

Setting parameters

lastfmApi.RequestTimeout = 50000;
lastfmApi.UserAgent = "Your own user agent";

Authenticating

Some API methods require authentication
lastfmApi.Authenticate("LASTFM_USERNAME", "LASTFM_PASSWORD");

Using the API

Console.WriteLine("Hyped tracks:");
var hypedTracks = lastfmApi.Chart.GetHypedTracks();
foreach (var item in hypedTracks.ItemsList)
{
    Console.Write("{0} - {1}, ", item.Artist.Name, item.Name);
}
Console.WriteLine();
Console.WriteLine("Loved tracks:");
var lovedTracks = lastfmApi.Chart.GetLovedTracks();
foreach (var item in lovedTracks.ItemsList)
{
    Console.Write("{0} - {1}, ", item.Artist.Name, item.Name);
}
Console.WriteLine();
Console.WriteLine("Top tracks:");
var topTracks = lastfmApi.Chart.GetTopTracks();
foreach (var item in topTracks.ItemsList)
{
    Console.Write("{0} - {1}, ", item.Artist.Name, item.Name);
}
Console.WriteLine();

Last edited Mar 19, 2011 at 6:59 AM by NikolayIT, version 6

Comments

No comments yet.