Skip to content

Commit

Permalink
Merge branch 'fix/#153-bandcamp-metadata' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Otiel committed Sep 24, 2020
2 parents 04f5c07 + 6c8845a commit 632dd07
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/BandcampDownloader/Helpers/BandcampHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,20 @@ private static string FixJson(string albumData) {
}

private static string GetAlbumData(string htmlCode) {
string startString = "var TralbumData = {";
string stopString = "};";
string startString = "data-tralbum=\"{";
string stopString = "}\"";

if (htmlCode.IndexOf(startString) == -1) {
// Could not find startString
throw new Exception("Could not find the following string in HTML code: var TralbumData = {");
throw new Exception($"Could not find the following string in HTML code: {startString}");
}

string albumDataTemp = htmlCode.Substring(htmlCode.IndexOf(startString) + startString.Length - 1);
string albumData = albumDataTemp.Substring(0, albumDataTemp.IndexOf(stopString) + 1);

// Replace " by "
albumData = albumData.Replace(""", "\"");

return albumData;
}
}
Expand Down

0 comments on commit 632dd07

Please sign in to comment.