[01:51:05] question about api: 'https://www.wikidata.org/wiki/Q42' is to 'https://www.wikidata.org/w/api.php?format=json&action=wbgetentities&ids=Q42' as 'https://www.wikidata.org/wiki/Special:WhatLinksHere/Q42' is to 'https://www.wikidata.org/w/api.php?.........' [01:51:40] how to get 'what links here' from the api? [01:52:37] im reading docs now but not seeming to find it [01:54:35] I'm not sure where is a endpoint for it. but you could query it. [01:55:08] im not sure what you mean can you explain more please? [01:56:29] https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20WHERE%20%7B%0A%20%20%3Fitem%20%3Frel%20wd%3AQ42.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0ALIMIT%2010 [01:56:33] something like that. [01:57:37] oh sql i didnt realise that was possible [02:06:39] i found https://www.mediawiki.org/wiki/API:Linkshere but it seems it works with page titles and not ids [02:07:59] or maybe it does and i just havent figured it out yet [02:09:32] https://www.wikidata.org/w/api.php?action=query&prop=linkshere&titles=Q42 [02:09:45] the ID is the page name in that given namespace. [02:09:59] which for wikidata is the main namespace. [02:17:23] ok we are gettting closer, but 'https://www.wikidata.org/w/index.php?title=Special:WhatLinksHere/Q42&namespace=0&limit=500' shows 107 results and this query shows 9, so we must still be missing something, sorry im quite new to this and maybe its obvious but i cant see it [02:18:22] oh lhcontinue i see here [02:18:38] im still reading [02:20:46] https://www.wikidata.org/w/api.php?action=query&prop=linkshere&titles=Q42&lhlimit=100&lhnamespace=0 [02:20:49] ? [02:22:00] https://www.wikidata.org/w/api.php?action=query&prop=linkshere&titles=Q42&lhlimit=100&lhnamespace=0&lhprop=title <- a little bit less noisy. [02:23:58] oh yes this is very good i think i can work with this, if you happen to use mpv and yt-dlp or otherwise have an interest, ill post the script i cook up from this [02:24:14] thank you very much for the help [02:27:17] * phschafft nods. [02:28:01] happy my babbling helped. [03:10:58] reading more i also found https://www.mediawiki.org/wiki/API:Backlinks which seems to be able to produce identical results, but is different in some way thats not apparent to me; it is clear that i should be using a generator rather tho so now im working on how to do that with either backlinks or linkshere [03:19:15] API:Linkshere - finds all pages that link to a given page. Note that, unlike API:Backlinks, which is a list module, API:Linkshere is a prop module. See the respective pages on API:Properties and API:Lists for how these two kinds of modules differ. [03:19:20] hm. [03:20:10] 'Lists differ from properties in that, instead of appending data to the elements in the pages element, each list has its own separated branch in the query element' [03:20:25] I must say that the API and it's structure is still a mystery to me. [03:20:37] so its just an extra set of {} in json i didnt notice [03:21:22] im still looking for more solid info about generators [03:21:30] hm. [03:22:06] I think the main difference will be if you try to do more complex queries. like query also for other data or query for more than one item at a time. [03:26:44] so lists are meant return pages, and props are meant to return data; they are both submodules of query https://www.mediawiki.org/wiki/API:Query#Query_modules [03:29:39] that is my (very limited understanding) [03:43:00] so i got https://www.wikidata.org/w/api.php?action=query&format=json&generator=backlinks&gbltitle=Q42&gbllimit=500&gblnamespace=0 which prints nearly exactly the same thing as https://www.wikidata.org/w/api.php?action=query&format=json&list=backlinks&bltitle=Q42&bllimit=500&blnamespace=0 where as i expected it to give the data from those pages; maybe generators dont work how i think, or at least i still dont get how to sue them [03:43:20] use* them [17:58:40] i see that https://www.wikidata.org/wiki/Q153770 shows instance of state media, yet https://query.wikidata.org/sparql?query=SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20WHERE%20%7B%0A%20%20%3Fitem%20wdt%3AP31%20wd%3AQ2324556%20.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%7D%0ALIMIT%20100 somehow fails to find it. have i missed something here? [18:43:52] ok https://query.wikidata.org/sparql?query=SELECT%20%3Fk%20%3FkLabel%20WHERE%20%7B%0A%20%20%20%20%20%3Fk%20p%3AP31%20%5B%20ps%3AP31%20wd%3AQ2324556%20%3B%20%5D.%0A%20%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%7D seems to work but im still wrapping my head around why lol