Jump to content

include flattened Anchor Link text in Discog Overviews


Recommended Posts

Posted

Would it be possible to update the discogs plugin to change

image.thumb.png.ee2ff9bfba1c0105d8f38a0f49d4ce9b.png

into

image.thumb.png.87657463f9fed8c7e49ea56f2c8c8ca1.png

https://www.discogs.com/artist/2412751

I have a prototype working (with little testing) with this function if it helps.

 /// <summary>Converts Discogs Markdown links and artist references to visible text.</summary>
 internal static string FlattenMarkdownLinks(string profile)
 {
     if (string.IsNullOrEmpty(profile)) return profile;

     // Discogs profiles use [a=Artist Name] for artist references and Markdown for links.
     // Preserve visible text while removing only the link/reference markup.
     var result = Regex.Replace(profile,
         @"\[a=(?<label>[^\]]+)\]",
         match => match.Groups["label"].Value,
         RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
     result = Regex.Replace(result,
         @"\[(?<label>(?:[^\[\]]|\[[^\[\]]*\])*)\]\((?<url>(?:[^()]|\([^()]*\))*)\)",
         match => match.Groups["label"].Value,
         RegexOptions.CultureInvariant);
     return result;
 }

creating my own plugin falls foul of discogs aggressive 429 rate limiting when the same endpoing is called in quick succession.

 

thanks for consideration.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...