3

I use BrickSet.com to easily find all sets containing a specific part e.g. http://brickset.com/sets/containing-part-374726. Is there a way on that site or any other to find all the sets containing two specific parts?

3
  • Someone gave the answer by editing someone else's answer to point out rebrickable's API. I've now got a simple call that fetches all the sets with one part in it, can can knock together a script to do the rest, but it looks like they have deleted the whole answer. If they come back with it I'll give them the points.
    – Craig
    Jan 7, 2017 at 7:56
  • I have un-deleted the answer that was deleted by the poster. If you would like to improve on the answer given or add your own answer to explain how you achieved this that would be great.
    – Ambo100
    Jan 7, 2017 at 12:51
  • Zhaph addition to the answer was the real solution here, but it wasn't really related to Andrew's answer I'm going to use the API and write an answer explaining how.
    – Craig
    Jan 7, 2017 at 23:10

3 Answers 3

3

Although clunky you could consider using Microsoft Excel to do most of the work for you.

  1. On Brickset search for the first part
  2. On the top bar click CSV or (comma separated values)
  3. Copy the text
  4. Open Excel (I'm using 2010)
  5. Select Cell A1
  6. In the top right corner click the arrow bellow paste and select "Import Text Wizard..." (depending on the version this option may be in another place)
  7. Selected Delimited and click next
  8. On the following page select "Comma" click next
  9. Select each row that is not "SetID" and select "Do Not Import" click finish (alternatively you can manually delete the extra rows after finish)
  10. Repeat steps for the second part you are looking for. However Select Cell B1 instead of A1. You'll end up with two rows of SetIDs
  11. Finally highlight both columns of SetIDs and select "Conditional Formatting", >"Highlight Cell Rules"> "Duplicate Values"

The cells that are highlighted will be the sets that contain both parts.

2
  • that will definitely work but it's not efficient enough for me.
    – Craig
    Jan 6, 2017 at 19:45
  • I've previously imported them to MS Access to get querying power. A little work to set up, but being able to write those queries was helpful.
    – user3911
    Jan 9, 2017 at 20:50
2

From what I can tell, there is no way to cross-reference within the site itself, but it wouldn't be difficult to write a short code to do the cross-checking for you.

I'm not a programmer or web-developer, so I lack any basic coding skills, but for someone who is more able, this would be a very simple task. After you open the page that gives the list of sets containing said part (one page for each of the parts you're looking for) you can easily find all sets sharing two parts by having your browser run a Jscript that does the following:

  1. Generates a list of all set numbers that contain said part (one list per page)

  2. Generates a list of all set numbers that are shared in all previous lists

Let me know if that is confusing...

7
  • Not confusing at all, I'm a programmer by day. I just hoped someone had written the code for me already :-)
    – Craig
    Jan 4, 2017 at 19:14
  • Hah! You lazy bum, you :) Although my older bro wrote a more complicated script than what I described in under 10 minutes, but hey, I can't blame you for trying to save 10 minutes :) Jan 4, 2017 at 21:04
  • 1
    Neither of the sites I know, BrickSet and BrickLink, have useful APIs for searching for the sets a part is in. The in-browser script you mention could be a GreeseMonkey type script but it would have to screen-scrape the target site and that sort of work can be fragile.
    – Craig
    Jan 6, 2017 at 1:11
  • Unfortunately, I only understood about half of what you said =/ I would suggest asking this question on another forum about how to easily extract that information from the page so that you can run the matching script. Because I have no idea. Hopefully someone with more programming knowledge will come along.... Jan 6, 2017 at 4:14
  • Also, you may be able to work around that by using the tab function. That way the script doesn't actually search the page for part numbers, since every part is an equal number of 'tabs' apart from each other. Jan 6, 2017 at 6:06
0

http://rebrickable.com has an advanced search option that allows you to search for parts within specific sets, that might be able to help you.

It also has an API that returns the sets containing a specific part: http://rebrickable.com/api/docs?fn=get_part_sets - although this does require the inclusion of a colour as well. From that you could write a simple comparison between the two results. However this probably won't scale all that well if you then want to find the number of sets containing 10 specific elements.

3
  • I don't see how that helps. I have two parts A and B and I want to find all the sets that contain both of them.
    – Craig
    Jan 6, 2017 at 1:09
  • Thanks Zhaph, that is very useful. I think it will be quite fast even with 10 lists because the algorithm would start with the shortest list and look for those sets in the other lists, remove any that aren't found and come out with only common sets. Your response is different enough from Andrew's that that it should be its own answer.
    – Craig
    Jan 6, 2017 at 19:35
  • 1
    It's not like I needed the rep, and it was on the basis of Andrew's original answer that I went to check rebrickable as I thought I recalled it having an API that could be used for this. Jan 9, 2017 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.