6

This question already has an answer here:

I couldn't find any way to get, through the API, a list of all questions that are duplicate of what other question.

For example, for the question with ID 10369, I want to obtain the question with ID 10372 (or the other way around, at least).

Is there a way to do so, other than scraping the page?

marked as duplicate by Martijn Pieters, ChrisF Jan 31 '14 at 20:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Have you checked any of the queries here? data.stackexchange.com/stackoverflow/queries?q=duplicate – Aaron Bertrand Aug 15 '13 at 16:53
  • And do you mean to restrict your search space to questions that have been explicitly closed as a duplicate of another, or include ones that have been accused of being a duplicate (e.g. there is at least one VtC but it hasn't been closed), or trying to identify ones that might be a duplicate (by similar/identical title, or some other magic)? I wouldn't try to use the API for this - this means at least one API call for every question, right? Have you seen how many questions are on SO? Yikes. – Aaron Bertrand Aug 15 '13 at 16:55
  • It doesn't matter if it's closed or not. What I need is a list of questions that are supposed to be "the same" for the person who flagged them. In the example above it's 10369 and 10372, but possible many other questions are the same as these two, well, I want to know that. – Matt Aug 15 '13 at 16:57
  • By the way, a list of all duplicate questions would be great but I don't think it's possible. I can call the API multiple times for the IDs I'm interested in, if it's necessary.. – Matt Aug 15 '13 at 17:06
  • If you went with scraping the page, you could get in trouble with the thousands of requests in just a few seconds. – Cole Johnson Aug 15 '13 at 17:31
2

Here's an example you can work with:

SELECT TOP 10 
  PostId,
  [Dupe(s)] = SUBSTRING(Text,CHARINDEX('[',Text),CHARINDEX(']',Text)-CHARINDEX('[',Text)+1)
FROM dbo.PostHistory 
WHERE PostHistoryTypeID = 10 -- closed question
AND Text LIKE '{"OriginalQuestionIds":%'
--AND PostId IN (your list)

I put TOP 10 so the query returns quickly. If you don't use TOP the query will likely timeout. You can remove that entirely if your list is reasonable.

  • Oh, that's nice, thanks! – Matt Aug 15 '13 at 19:02
-1

You can use the data dump and write your own queries, I don't think there currently exists a way to do it via SO.

Not the answer you're looking for? Browse other questions tagged .