The following call scans two pages on en.wikipedia.org and returns pages which are linked from those:
But I am unable to identify which links occur on which page. For example, the link to nuclear tests
exists on the Mannequin
page, but this is not indicated in the output of the above. I would like to have that information in the output.
Can this be done?
Most generators don't provide any kind of information about the generated page. (See https://phabricator.wikimedia.org/T263841 for a somewhat related discussion.) You'd have to turn it into a non-generator query. In your specific example you don't actually take advantage of it being a generator, so this is easy to do: https://en.wikipedia.org/w/api.php?format=json&formatversion=2&errorformat=plaintext&action=query&prop=links&plnamespace=%2A&pllimit=max&titles=Mannequin%7CResuscitation In other cases, not using a generator might mean you need to make some extra queries.