Expand description
§lastfm-edit
A Rust crate for programmatic access to Last.fm’s scrobble editing functionality via web scraping.
This crate provides a high-level interface for authenticating with Last.fm, browsing user libraries, and performing bulk edits on scrobbled tracks. It uses web scraping to access functionality not available through Last.fm’s public API.
§Features
- Authentication: Login to Last.fm with username/password
- Library browsing: Paginated access to tracks, albums, and recent scrobbles
- Bulk editing: Edit track names, artist names, and album information
- Async iterators: Stream large datasets efficiently
- HTTP client abstraction: Works with any HTTP client implementation
§Quick Start
use lastfm_edit::{LastFmClient, AsyncPaginatedIterator, Result};
#[tokio::main]
async fn main() -> Result<()> {
// Create client with any HTTP implementation
let http_client = http_client::native::NativeClient::new();
let mut client = LastFmClient::new(Box::new(http_client));
// Login to Last.fm
client.login("username", "password").await?;
// Browse recent tracks
let mut recent_tracks = client.recent_tracks();
while let Some(track) = recent_tracks.next().await? {
println!("{} - {}", track.artist, track.name);
}
Ok(())
}§Core Components
LastFmClient- Main client for interacting with Last.fmTrack,Album- Data structures for music metadataAsyncPaginatedIterator- Trait for streaming paginated dataScrobbleEdit- Represents track edit operationsLastFmError- Error types for the crate
§Examples
See the examples/ directory for complete usage examples including:
- Basic login and track listing
- Bulk track renaming operations
- Artist and album browsing
- Recent tracks monitoring
Re-exports§
pub use album::Album;pub use album::AlbumPage;pub use client::LastFmClient;pub use edit::EditResponse;pub use edit::ScrobbleEdit;pub use error::LastFmError;pub use iterator::ArtistAlbumsIterator;pub use iterator::ArtistTracksIterator;pub use iterator::AsyncPaginatedIterator;pub use iterator::RecentTracksIterator;pub use scrobble_edit_context::EditStrategy;pub use scrobble_edit_context::IntoEditContext;pub use scrobble_edit_context::ScrobbleEditContext;pub use track::Track;pub use track::TrackPage;
Modules§
Structs§
- Html
- An HTML tree.
Type Aliases§
- Result
- A convenient type alias for
ResultwithLastFmErroras the error type.