Added url parser class to find out which type of url is entered

This commit is contained in:
2026-06-14 17:16:32 -04:00
parent a24d2d6443
commit 685f75b208
4 changed files with 150 additions and 0 deletions

28
src/url_parser.hpp Normal file
View File

@@ -0,0 +1,28 @@
#pragma once
#include <optional>
#include <string>
enum class UrlType {
SpotifyTrack,
SpotifyPlaylist,
SpotifyAlbum,
SpotifyArtist,
YoutubeVideo,
YoutubePlaylist,
Unknown
};
struct ParsedUrl {
UrlType type;
std::string id;
};
std::ostream &operator<<(std::ostream &os, UrlType type);
class UrlParser {
public:
static std::optional<ParsedUrl> parse(const std::string &url);
};