~jacksonchen666/quick_statement_generator_for_software_version_identifier

00fabe6794dd285870f0b3d6b9a682518bd782aa — Jackson Chen 11 months ago 0d0642b
fix bug scenario where P348 is empty
1 files changed, 8 insertions(+), 0 deletions(-)

M fetchers.go
M fetchers.go => fetchers.go +8 -0
@@ 142,6 142,14 @@ func FetchWikidata(item string) (versions *[]DestinationInfo, err error) {
		raw = []byte(result.Raw)
	}
	parsed := gjson.ParseBytes(raw)

	// scenario where P348 is empty
	if parsed.Type == gjson.Null {
		_versions := make([]DestinationInfo, 0)
		versions = &_versions
		return
	}

	theVersions := parsed.Get(`#.mainsnak.datavalue.value`)
	publicationDates := parsed.Get(`#.qualifiers.P577.0.datavalue.value.time`)