HDbits indexer broken after api change

hdbits changed their api and from today, the hdbits indexer cannot connect to hdbits anymore.

"For the API, and applications that use it, there will be a small change: it will no longer be possible to search torrents by id. This should be the only breaking change In addition, the response field “id” will now contain the download hash, which can be used in download.php (and details.php). "

I notice that the hdbits inderxer tries to convert the id to a Int64, which was fine before, but now that id is a hash, you get a conversion exception. Example/excerpt:

Newtonsoft.Json.JsonSerializationException: Error converting value “2aa43e456d6c5ddb1ad03e7ac70a416ea4a2be84e478045ae390814327c5d2fee581ad21b8f056a49cfbd1fddd5bb8c6fb1353caaa17dd3666b55e1383c27fc5” to type ‘System.Int64’. Path ‘[0].id’. —> System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
— End of inner exception stack trace —

Update 160830: I spoke with the hdbits developer and the change has been reverted, so it works for now.
To be ready, we should use a more generic solution that can handle hashes/letters as id, and not only numbers.

int isn’t interchangeable for a string, in json it’s:
{ "id": 123 } vs { "id": "123" } and is distinctly different. Only way to support it would be to say that id is just an object without a specific type. If we convert the field to string it would puke on integers.
Afaik HDBits has a ‘hash’ property as well, so not sure why there should be a duplication.
However, if hdbits wants to switch to id = string, I’ll happily change the property type to object, afaik we don’t really use the property itself.

I’ll use the github issue to track changes for this.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.