Sciencemadness Discussion Board

Chemical Price Comparison Software in the making..

Maui3 - 16-11-2024 at 10:11

I am currently developing a price comparison software for chemicals that are shipped to private individuals.

I was curious if y'all had any ideas for neat features I could add to my software?

I will most likely make it freely available for everyone, once I am done coding it.

I am sorry if this is not the place to ask.

Maui3 - 16-11-2024 at 10:13

Oh and I probably need some help with names for the software too. I am bad at naming things :/

Sir_Gawain - 17-11-2024 at 09:58

What exactly are you making? A database of sources for common chemicals? If so, are you only considering chemical suppliers? I’d be happy to contribute sources if you need any.

As far as names; Chemlist, Chemsource, etc.

Texium - 17-11-2024 at 10:21

I hope you intend to have it auto update prices and availability? Otherwise it would not be very useful...

I'm imagining something similar to SciFinder's supplier search, except with inclusion of more amateur-friendly sources and the option to exclude suppliers that don't sell to individuals. If you can make something like that, it would be quite excellent! Here's an example screenshot for those who haven't had access to SciFinder:

Screen Shot 2024-11-17 at 11.20.06 AM.png - 338kB

bnull - 17-11-2024 at 10:52

What about ChemPare? Because you want to compare prices of chemicals.

An interesting feature would be filtering by form (solid, liquid, solution, prills, powder), grade, purity, packaging size, shipping options, price range.

Get in touch with those companies that sell to individuals. They may have some ideas you can try.

Sir_Gawain - 17-11-2024 at 11:16

You could open a spreadsheet and allow anyone to add to it. Besides filtering by the options bnull mentioned, a filter by country would be extremely useful. For example, while concentrated sulfuric acid is banned in most of Europe, in the US you can walk into a Walmart and buy a liter of 93% for six bucks.

Dr.Bob - 17-11-2024 at 18:33

Many years ago the MDL chemical source database had both the normallized amount of each chemicalm, and the cost per gram/ml in it, assuming everything was a density of 1. It was great for finding the lowest prices of a set chemical from many vendors, and the releative error was small as each chemical is typically sold in either ml or grams.

I miss that system, it might still be there, but I have no access now.

Sulaiman - 17-11-2024 at 22:38

I suggest that links to suppliers should only be published
AFTER consent is received directly from the supplier
(and ask if there is a simple method of updating your database)
- some suppliers want more sales, some appreciate discretion.

Please do not jeopordise supply chains.

PS clearly indicate the date of any costings
otherwise false conclusions are likely.

[Edited on 18-11-2024 by Sulaiman]

Maui3 - 18-11-2024 at 04:20

Yes - exactly! It's going to be automatically updated and only contain suppliers who send to private individuals.
I also thought about a filter by country, so I'll definietly add that too!
ChemPare or ChemSource sounds good!

Maui3 - 18-11-2024 at 04:21

Yes, exactly like Scifinders, just for suppliers who sell to private individuals!

bnull - 18-11-2024 at 05:18

Don't forget to consult the members of the forum that also sell stuff. You have probably seen their threads here in Reagents and Apparatus Acquisition. There's @mario840, @chemship1978, and @Texium (you're still selling, right?), for example. @Dr.Bob and @tomholm may have some stuff, but they deal more with glassware and the occasional equipment.

Texium - 18-11-2024 at 10:11

Quote: Originally posted by bnull  
@Texium (you're still selling, right?)
Yes, I still have lots of stuff available. It's just been rather quiet the last few months and I haven't been regularly bumping my thread.

I feel like individual sellers with limited stock fall outside the purview of this project though.

Maui3 - 19-11-2024 at 11:05

Do any of you all have some good suppliers you want me to add to the website database?

Texium - 19-11-2024 at 11:08

Here's a good place to start: https://www.sciencemadness.org/smwiki/index.php/Lab_supplier...

Maui3 - 19-11-2024 at 11:16

Thank you Texium - I see that I actually added a bit of them already. I have S3-Chemicals, Lerochem and Onyxmet now. I will add more the upcoming days, and when I have a good amount of suppliers (not just from Europe) I will publish it! The reason the others are taking a bit of time is that their websites search function is.. quite bad.. so with some I have to find a sneaky way to make the search work.. Like if it was a website from The Netherlands I will make the english search query get translated to Dutch. Else there just won't pop any results up.

I will (most likely) need more feedback in the future - so I am happy to know that I can return here if I have more questions.

j_sum1 - 19-11-2024 at 23:36

A couple of thoughts.
  • I think you are going to have to work hard to get it automatically updating. Especially as a lot of suppliers do not even post prices but instead request you apply for a quote.
  • A lot of the time, especially for amateurs who are doing things on the cheap, the shipping cost is a significant component. And this cannot generally be calculated from standard shipping rates since it depends on the company being employed and what the hazard shipping requirements are. This makes comparisons between companies problematic. Outside of your scope of course but something to be aware of.
  • It would be worthwhile if possible to have flags come up on the legal status and restrictions in various locations. There are some chemicals that require an end used declaration if I buy them locally in Australia, but I am free to have delivered over the border. What is readily available in one location is tightly restricted in another, and there are all manner of weird anomalies. Flagging restrictions on purchase, owning and shipping based on location and location of supplier would be extremely helpful.

    As for a name, Chemfinder would work.
    Or if you were ok going with something that reduces to an acronym, the Hobby Chem Procurement Database. I am sure you could create a suitable logo.

    Finally,
    I wish I had a good list of Australian suppliers to recommend. My problem now is that I have an extremely well stocked lab and I really have little need to buy stuff. Which means that I am very out of touch with who is good, who is not, or who is even in business. But if you did have Australian suppliers on your list, I would certainly be scanning them regularly.
    (Right now I have lost my best source of OTC ethanol. I was about to buy some methanol and discovered the local supply had gone out of business. And I have a few possible projects that could use some potassium ferrocyanide. The ferri is much easier to source.)

    Maui3 - 20-11-2024 at 00:59

    Those are all great points!
    Most of the suppliers that send to private individuals I use (and have seen) do actually post their prices. But I can imagine this would be quite different depending on where you live.
    I will see if I can add shipping costs to my software too.
    Yes, that's a great idea. I I'll definitely add those flags.
    I'll definitely add Australian suppliers too!

    Texium - 20-11-2024 at 11:03

    If you can figure out a way to include or at least estimate shipping costs, you'll be better than SciFinder's search! And regarding companies that make you ask for quotes rather than listing prices, I think it would be fine to just show that they supply the chemical. That is what SciFinder does. Having a compiled list of suppliers in one place is already awesome, even if users still have to inquire with individual companies. It wouldn't be practical to automatically get quotes for every chemical they sell and would be impossible to keep updated.

    As a side note, I know your intention is to focus on suppliers that sell to individuals, but in the future I think it would be great if you would include other more conventional chemical suppliers as well. It should be easy enough to have a filter that excludes them. Not every business (especially among small businesses) has access to SciFinder, as it's a very expensive service. I think it would actually be helpful and desirable to have an alternative service. You could even make it a premium feature that commercial clients would have to pay to access, while keeping the individual-friendly supplier search free for everyone.

    4-Stroke - 20-11-2024 at 16:26

    I would really recommend you include Alibaba because there are a few advantages:
    -They usually sell to anyone (including individuals)
    -The prices are really cheap
    -They often offer free samples
    -Almost everything is available on there


    The main problem is that the shipping can be really expensive (and I mean >$100 for a kg sample, but usually less).

    AvBaeyer - 20-11-2024 at 19:33

    It is not clear to me exactly what the proposed database will provide. Will it be only a compilation of friendly suppliers that sell to individuals with links to their websites and catalogs? Will it be a chemically searchable database linking a compound search to "friendly" suppliers who offer the chemical so that one can compare prices? Now it gets complicated. How would a chemical search be carried out - formula, structure, CAS number, name (keep in mind that names can vary for a compound between catalogs)? How sophisticated should this proposed database be?

    As an example, Chemical Book has a very useful chemical search program that is quite useful in that in that it can be searched using several types of inputs. Importantly, for organic compounds, one can do substructure and similarity searches.

    I am not a coder or programmer in the slightest. I only use chemical databases with no real understanding of how they work behind the screen.

    AvB

    Maui3 - 21-11-2024 at 00:59

    Thank you Texium, will do!

    Good Idea 4-Stroke. I think I can add Alibaba too!

    AvBaeyer, it works like this: You enter the IUPAC Name or CAS number, and it'll find suppliers that sell that compound, and display them. When you click on the display you'll get redirected to their page for that compound. I think I'll use the Pubchem API to see other names of same chemical so it'll automatically search for them all.. But I am still thinking about the smartest way to do that :)


    Maui3 - 21-11-2024 at 07:37

    Right now I also added a feature where it'll tell you if they need end-user-statement for that chemical :)

    dettoo456 - 21-11-2024 at 09:44

    I’ve bought from ChemDirect before, and had no issues except some long-ish shipping delays. Their model seems to be pretty seamless although they do only sell to companies and generally require an end-use statement (lying works around that).

    Their website’s UI may be useful to you, it’s currently under maintenance though.

    Maui3 - 23-11-2024 at 09:26

    Thank you dettoo456 - I'll keep that in mind!

    Maui3 - 24-11-2024 at 04:01

    8 Suppliers already added! It's beginning to look very nice now. These are all in europe, so I'll have to add some in other continents as well. Futhermore I added a dropdown menu so you can choose the country you are from. This way It'll be more specific and the shipping costs will be lower.

    Maui3 - 24-11-2024 at 04:05

    I'll also add a kind of "filter", so let's say when you write "Sodium" it might also show SODIUM hydroxide or SODIUM carbonate right now, I'll have to add some kind of system so it automatically only shows the element SODIUM.

    I'll make it freely available for everyone! ( if I didn't already mention that eariler in the thread. ) Plus I'll probably also make the source code public, so if anybody wants to make a tweak they can do it.

    Chemi Pharma - 29-11-2024 at 03:12

    Hi my friend.

    I already replied your post asking for price of reagents but I think you've a very, very hard job on your hands. prices changes like Dollar and EUROs quotation changes. They can change everyday and every time. Like some actors here in this Blog already have said it's important to know which country do you want to deliver the goods cause the Customs specifications that's different country by country. It will be a difficult job to create something like you're wiching for, but I'm really wish you a good luck!

    Maui3 - 29-11-2024 at 10:44

    Thank you!
    I mean, SciFinder already has done this. What I am really trying to do is just make a "SciFinder" for suppliers that sell to private individuals, and is completely free. But I will do my best to include shipping costs etc.

    Maui3 - 15-12-2024 at 03:25

    Right now I am working on adding suppliers in the U.S.

    I am using this forums list of suppliers, but I do not know which ones you guys prefer.

    Right now I have added Carolina Chemical, Science Company and Elemental Scientific. Which ones do you all think I should add next?

    Texium - 15-12-2024 at 08:36

    Well, Elemental Scientific is shutting down and clearing house, so you might actually have to remove them.

    If you are willing to include suppliers that are not officially chemical suppliers but sell a good variety of chemicals, Duda Diesel and Seattle Pottery Supply are among the most popular.

    As far as actual chemical suppliers go, Ambeed has basically everything, but while they will allow you to purchase with a personal credit card, I’m not sure if they ship to residential addresses. The only time I ordered stuff for myself from them, I had it shipped to my university address just in case. So someone else will have to confirm if they truly ship to individuals. Same goes for Oakwood Chemical, Combi-Blocks, and aablocks.

    Maui3 - 15-12-2024 at 09:11

    Ah, didn't know that - will remove Elemental Scientific now then.. It was actually so difficult to add Elemental Scientific :/

    And yes, I can definitely still add Duda Diesel and Seattle Pottery Supply. I geuss amateur chemistry is all about getting chemicals from accessable sources, so it makes sense to add them.

    I am pretty sure Ambeed ships to residental addresses, so I'll add them too.

    Thanks for the list!

    chempyre235 - 17-12-2024 at 10:22

    I have compiled a list of potential suppliers in the US. Keep in mind that I have not purchased anything from these sites, and so may need some vetting before adding them to your software. I tried to exclude sites already listed on this site. Also, I have not verified that all of these, sell to residential addresses.

    Some of these I think will be a good addition. There is one that specifically sells solvents and other chemicals relatively cheaply, and for amateur purposes. There is also another site I found that sells polymer precursors. I hope it helps! :D

    Attachment: supply.docx (14kB)
    This file has been downloaded 95 times

    [Edited on 12/17/2024 by chempyre235]

    Maui3 - 17-12-2024 at 10:24

    That's a lot of suppliers chempyre235!
    Thank you - it definitely helps!

    Cathoderay - 17-12-2024 at 15:41

    I have ordered many things over the years from McMaster-Carr as an individual. The shipping method is fast but pricey. The website is simply www.mcmaster.com

    chempyre235 - 23-12-2024 at 21:03

    I found a couple more possible sites:

    https://www.chemimpex.com/
    https://www-live.chemdirect.com/

    Again, they need checked because I haven't ordered from these.

    kyfuge - 24-12-2024 at 09:04

    Quote: Originally posted by chempyre235  
    I have compiled a list of potential suppliers in the US. Keep in mind that I have not purchased anything from these sites, and so may need some vetting before adding them to your software. I tried to exclude sites already listed on this site. Also, I have not verified that all of these, sell to residential addresses.

    Some of these I think will be a good addition. There is one that specifically sells solvents and other chemicals relatively cheaply, and for amateur purposes. There is also another site I found that sells polymer precursors. I hope it helps! :D



    [Edited on 12/17/2024 by chempyre235]


    The list says Carolina Chemical doesn’t exist anymore, but their website still works for me. Carolina Biological is an entirely different company.

    Maui3 - 11-1-2025 at 08:39

    As I am soon done polishing the european version, if anybody want's to be a tester for my software, I'd appreciate it!
    I'll still need to fix a few things.

    Maui3 - 9-2-2025 at 03:35

    It was a bit more dififcult to do in javascript, so I decided to do it in python. When I am done, I can always just do it in JS afterwards too.
    Anyway, this is how it's looking in a console app so far. I am still adding the shipping, quantity, notes, etc.

    I still need some beta-testers, if anybody is interested? I am still not done for the beta-version yet, so it's going to take a while still.
    Also, it is a bit more difficult for elements. For example if you search "sodium", the top results are sodium chloride, etc, but I'll get to fixing that.

    [Edited on 9-2-2025 by Maui3]

    SuperOxide - 9-2-2025 at 06:54

    Couple of questions,

    - You said this will limit the scope to suppliers that sell to individuals. How about for specific products? eg: Carolina Chemical sells to individuals, even 1L of H2SO4. But if you try to buy the 2.5L (or larger) bottles of H2SO4 then they require that you be a school or run a business (and ship to those addresses)
    - How does this pull the prices? Did you go to each individual supplier and see if the frontend sends requests to a backend API, then use those? Does it just scrape the HTML for simpler websites? I'm hoping you have some simple modular system that allows for small changes (eg: if the paths or ID's of the elements change, they use pagination, etc).
    - Do the results get cached for any amount of time? eg: If the same SKU or CAS gets pulled up in different search results, it might not make sense to query/parse the same web page/product multiple times within 24 hours).
    - Is this going to be open source?

    Hopefully you're structuring it so that there's just some logic module that does the data, then that can be used in either a CLI client (like what you're showing) or use something like FastAPI to create a basic web client.

    I'm a software engineer, I do NodeJS for my professional job but I do a bunch of Python on the side (mostly for 3D printing related, eg: moonraker), and I'd love to see the code for this :-) (show me yours, ill show you mine).

    Maui3 - 9-2-2025 at 08:50

    Of course! I love you alls questions and feedback!

    1: I have not checked the website for Carolina Chemical, but for some of the european ones there will be a little popup saying that it is not sold to private individuals above a certain concentration or amount. My python script could potentially check for that.

    2: This was very difficult to get to work, so the way it works right now is like this: It uses the search link, for example: "example.com/search=" + the chemName. Then it uses beautifulsoup to extract the HTML, where it finds the product and price from their classname. As you noted, this can be quite unreliable - so I am definitely also considering possibly doing a daily check for each of the websites in the sitemap.xml (since it'll take too long to do for each individual search), whereafter it'll find the product name and price - possibly by finding the first currency-symbol and then the closest chemName to the price-element. Of course chemical names differ, so it'll run through the Pubchem API for all of the synonyms.

    3: That's kind of what I considered too (like I said in 2) - but so far it only checks for individual searches. There is not database, yet. I also thought that if I was to do this, I would do it as one of the last things, since making it extract the price and chemical name is the most important thing.

    4: Yes, of course! Besides, if the chemical suppliers websites whole system and URLs change, I would much prefer if it could be fixed by others than me. Also, I am just a amateur chemist and amateur programmer, it would be very ineffecient and ignorant to only let me edit it and understand how it works.

    Yes I am structuring it like that.

    Oh, maybe you can help me with some of it then - I will definitely need help at some point.. probably more than just one point. If you would like to help me with whereever I need help, I'd really appreciate it.

    Yes - I'll show you the code. It's structured quite poorly now - with variables that are.. well.. badly named. I'll fix it and send it to you in just a bit. Where (and how) would you prefer me sending it to you?

    EDIT: I would loved to have used the suppliers APIs, I really would - but most of the suppliers never replied back to me after I told them I would like an API. There was one that replied back saying they'll send my message to their "tech-team", after which they could send me the API. It's been three months, they have no intentions on doing that.

    [Edited on 9-2-2025 by Maui3]

    SuperOxide - 9-2-2025 at 16:04

    Quote: Originally posted by Maui3  
    1: I have not checked the website for Carolina Chemical, but for some of the european ones there will be a little popup saying that it is not sold to private individuals above a certain concentration or amount. My python script could potentially check for that.

    Carolina Chem is an easy one for this, it always just says "This item is sold and shipped to schools and businesses only.".

    Quote: Originally posted by Maui3  

    2: This was very difficult to get to work, so the way it works right now is like this: It uses the search link, for example: "example.com/search=" + the chemName. Then it uses beautifulsoup to extract the HTML, where it finds the product and price from their classname. As you noted, this can be quite unreliable - so I am definitely also considering possibly doing a daily check for each of the websites in the sitemap.xml (since it'll take too long to do for each individual search), whereafter it'll find the product name and price - possibly by finding the first currency-symbol and then the closest chemName to the price-element. Of course chemical names differ, so it'll run through the Pubchem API for all of the synonyms.

    I've had to automate stuff like that. It's... even less fun than it sounds, lol.
    A lot of these websites keep the chemical synonyms paired with the listing, so typically searching for any of them should return the same product (at least on a few that I tried).

    Quote: Originally posted by Maui3  

    EDIT: I would loved to have used the suppliers APIs, I really would - but most of the suppliers never replied back to me after I told them I would like an API. There was one that replied back saying they'll send my message to their "tech-team", after which they could send me the API. It's been three months, they have no intentions on doing that.

    Well, sir, since it would be a client side API (if its used on their website), just keep an eye on your networking tab of your browser.

    Example of how to do it with LigmaAldrich

    1) ProductSearch query:


    gets a response with unique product keys:


    2) Using the unique productKeys, request the Pricing and Availability endpoint:


    Which will give you the price:


    I think this would almost have to be done for some of them that populate the UI using RESTful calls from the client side. Otherwise, whats the best option? Launch a headless browser to track the client side requests? Way more tedious.

    Quote: Originally posted by Maui3  

    3: That's kind of what I considered too (like I said in 2) - but so far it only checks for individual searches. There is not database, yet. I also thought that if I was to do this, I would do it as one of the last things, since making it extract the price and chemical name is the most important thing.


    I guess this comes down to if you want it to be a stand alone client, or a service you provide? (Or either?) If its a service you provide, I would have it cache the prices only on the first time its requested, and have a TTL for the prices that can expire, and only then will new requests for that item trigger actual price updates.

    If its a stand alone client, then I would do the same thing, but store it in a sqlite database.

    Quote: Originally posted by Maui3  

    4: Yes, of course! Besides, if the chemical suppliers websites whole system and URLs change, I would much prefer if it could be fixed by others than me. Also, I am just a amateur chemist and amateur programmer, it would be very ineffecient and ignorant to only let me edit it and understand how it works.

    Excellent! Open source is the way to go.

    Quote: Originally posted by Maui3  

    Yes I am structuring it like that.

    This is something you really need to put some time into and think about. It looks like you're just developing a Proof Of Concept right now, so its not a huge deal, but when you work on the first release this is something that is key. Every website operates differently, but you want the same data. So I would create it in a way that each site has its own module that just takes an input, then it can go about getting the data (cache, RESTful API search, HTTP requests and parsing data, etc), then return a simple object with the results. Obviously each one should be in its own file, making it super easy to replace/update them when needed.

    Quote: Originally posted by Maui3  

    Yes - I'll show you the code. It's structured quite poorly now - with variables that are.. well.. badly named.

    That's a bad sign, though I'm guilty of it as well. If you're doing this in Python I would highly recommend putting a hold on your coding and read through the PEP8 style guide first. It seems silly, but coding in a specific style will save you headaches later on. And its just more professional, so you should get use to it ;-)

    Quote: Originally posted by Maui3  
    I'll fix it and send it to you in just a bit. Where (and how) would you prefer me sending it to you?

    Then throw this baby up on Github, I'd love to take a look at it :-) I do a lot of programming for work, so I rarely dive into more programming on the side, but this might be a good way to contribute to the amateur chemistry community that has helped me so much.

    [Edited on 10-2-2025 by SuperOxide]

    [Edited on 10-2-2025 by SuperOxide]

    SuperOxide - 9-2-2025 at 17:47

    Here's an example of how to use Chemsavers API endpoints.

    Sending the query for toluene:


    And you get back a pretty beefy response with all the related products, and their prices:


    But how do you do it programmatically?

    Grab the curl request command for that specific request:


    Throw that in your console, add some jq to make it pretty and get the data you want:


    Do you need it in a different language? Python you said? Use CurlConverter.com for that:


    The same process would work for AmBeed:

    Obviously it might be better to search by CAS for Ambeed, or you could just look through the results to make sure they're what you expect. I searched for "toluene" and got a lot of results, none of which were actually toluene.

    Elementalscientific has something that you can query, it returns the price as HTML, but that makes parsing it a heck of a lot easier:


    Before you go through and do all the work on the search code for your tool, I would say go through to each chemical supplier and see if they have a public facing API when you search on their website. Create a list of which ones do have API's, which don't, and which ones are a hybrid (some have an API for searches, then you'd need to parse the HTML for the price - example: Carolina Chemical).

    [Edited on 10-2-2025 by SuperOxide]

    Maui3 - 10-2-2025 at 08:48

    Thank you SuperOxide!

    I am still a bit confused with exactly what to do, but I have been researching it a bit, and I am still a bit confused :P .. but it helped!

    There is this european website I want to include: https://www.laboratoriumdiscounter.nl/en/
    I am having a hard time finding their public facing API. Maybe they do not have one? What do we do with those?

    Thank you for your help! I really appreciate it!

    SuperOxide - 10-2-2025 at 12:32

    Quote: Originally posted by Maui3  
    Thank you SuperOxide!

    I am still a bit confused with exactly what to do, but I have been researching it a bit, and I am still a bit confused :P .. but it helped!

    Which part are you confused about?

    Some of the simper websites are just basic HTML (eg: DudaDiesel). Those you would pretty much need to just curl the endpoint that the search goes to, then parse the output for prices. Not really any easier way to do it.

    Then some of the other, more advanced websites have public facing API endpoints that are used to make the website quicker. Since they're public facing, you should be able to query it.
    For some, you may need to send a simple cURL request to the main website and look at the return headers for a cookie or some session key, and use that value in the subsequent API calls. But that's not super difficult. And not all of them require that.

    Quote: Originally posted by Maui3  
    There is this european website I want to include: https://www.laboratoriumdiscounter.nl/en/
    I am having a hard time finding their public facing API. Maybe they do not have one? What do we do with those?

    It looks like they do have an API, and probably the easiest one I've seen so far, lol.
    Here's how to tell: https://imgur.com/hjLzxrd
    And I had to break the video up in two since imgur limits it to 1 minute. Heres the end of that where I show how easy it is to change the product you're querying for: https://imgur.com/ZMkHcFw

    P.S. In the videos I shared, you can tell im using a Macbook. So you might not have the same functionality I do on the command line. But still, it was just to show you how it can be done.

    P.S.S. Here's some very crude python to grab the cheapest price for whatever the search string is:
    Attachment: php8vYt1p (18kB)
    This file has been downloaded 23 times

    Obviously you would want some logic that would make sure the result item you're analyzing is actually what you searched for. You can see I searched for benzene and it returned (1-Bromoethyl)benzene >95.0%(GC) 25g. But if I searched for the CAS of Acetone, it returned acetone.

    [Edited on 10-2-2025 by SuperOxide]

    Maui3 - 11-2-2025 at 00:52

    Thank you! Now I understand! :-)

    Yes I get what you mean, their websites search function is not very nice for IUPAC names. I think we will do CAS-numbers instead, then.

    So for the rest of them, that don't have an API (the smaller ones), do we just do my initial approach with them? .. which was using BeautifulSoup to get the HTML, and use the classes to find the price and product?

    SuperOxide - 11-2-2025 at 06:04

    Quote: Originally posted by Maui3  
    Yes I get what you mean, their websites search function is not very nice for IUPAC names. I think we will do CAS-numbers instead, then.

    Yeah, the thing is that people are probably going to want to search for names too. And what if not all websites allow you to search by CAS?

    What I would do is allow someone to type in a CAS or chemical name, then you query Pubchem to get a list of chemicals with that name in the title (obviously putting exact matches at the top of the list, since they're most likely the correct one), and allow the user to select the chemical from that list. That way you know the exact name and CAS number, allowing you to search for either (or both, if applicable). This would be a property you would include in the module for each vendor (eg: allowsCasSearch) to see if you can just jump right to the CAS search instead of Name search that you then need to verify the CAS for on each (if possible).

    I think this is a good approach, because if someone searches for a chemical with the name Supercalifragilisticexpialidocious, you don't really want to query every website for that name if you're fairly certain it doesn't even exist, right? Just a thought :-)

    Quote: Originally posted by Maui3  
    So for the rest of them, that don't have an API (the smaller ones), do we just do my initial approach with them? .. which was using BeautifulSoup to get the HTML, and use the classes to find the price and product?

    Yes, unfortunately. And that's the tedious part.

    Lets look at DudaDiesel as an example. Querying for products is very easy, just need to cURL their seach.php page with the query parameter. If I wanted to search for acetone, I would query the URL: https://www.dudadiesel.com/search.php?query=acetone.
    That would return a plain HTML page, no fancy AJAX queries to get the prices - they're all on that page.
    But then parsing the page to get the prices is a bit of a nightmare:

    1. The prices themselves don't start with a currency sign.
    2. There are input fields for quantities, which do contain the prices in hidden inputs, but not all items have those. The freight items don't, for example.
    3. The HTML nodes with the prices don't have any unique identifiers or classes that you can directly search for, neither do their parent elements, or their parent elements, etc.



    1. The only way I can think of to get the price values from this mess, is to look for div.item_spec HTML elements that contain strings "QTY" and/or "$Ea.", then grab the next sibling div.item_spec that has a float value in double quotes - and assume that's the price.
    2. Alternatively, since all of the price elements seem to be formatted like <b>1+</b><br />8.48, you could look for any div.item_spec elements that have content that matches the RegExp pattern <b>([1-9]+)\+<\/b><br \/>([1-9]+\.[1-9]+), which would give you the quantity and the prices (example of pattern).
    3. Regardless of which of the above two parsing options you choose, you would need to narrow down each one to the specific <table> or <tbody> node for each individual product listing.

    As you can probably guess, the above searching can be pretty tedious. And it would be even worse if the prices aren't listed on the search results page, so you would need to parse the search results page for links to the products, then cURL each of those pages and run similar logic to get the prices.
    This gives me a headache even thinking about it, lol.

    While I have't used Pythons BeautifulSoup before, it does look like it would be able to take care of this.

    Do you have a list of websites you want to include? Post them here. Maybe I can help with a quick analysis of each.

    And do you know much OOP? I think the best way to handle this would be to create an inheritable class that has the main common methods that would be used for any of the merchant websites (simple cURL functions, JSON parser functions, HTML parser functions, etc), then each website you want to query would have its own class that inherits the base class, and is in its own file that would be included/imported and used to query for prices on that website.

    I have an example of that type of setup in a recent project I was working on. I created a Moonraker plugin module called moonraker-contrast which needs to be able to parse gcode files from different slicers, so each slicer has its own module file, which contains a class for that specific slicer type (each of which inherits from a generic slicer class that has the common methods), and each slicer module is included in the main contrast.py file.
    This means if I need to change the logic for one slicer (or in your case, chemical supplier website), I can just modify that one file. And if anyone wants to add a new supplier to the search feature, they just need to create a new module/class that inherits the base class, and put it in the right directory.

    But, first things first. Do you use Git (revision control)? If not, start using it. Sign up on Github.com (free), create a repository for this project, then install git on your local machine and commit some code to it. Start checking in your changes so you don't lose any of your files or anything.
    - Install git
    - Create a repo and add some code to it

    Sorry if this is a lot of information for you to take in. I think this is an excellent learning opportunity for you though, and the project as a whole sounds like an excellent idea.

    [Edited on 11-2-2025 by SuperOxide]

    [Edited on 11-2-2025 by SuperOxide]

    Maui3 - 11-2-2025 at 09:21

    This sounds like a great idea!

    I will start working on all of this (setting up github, coding, listing website, etc.)!

    For the list of websites, I can list the european ones, as I am from Europe. I do not know enough about where to buy in North America (or other places) to make a list for that. But this page could be helpful for that: https://www.sciencemadness.org/smwiki/index.php/Lab_supplier...

    For the european ones, this is what I've got:

    Laboratoriumdiscounter
    Pretty much everything (at a quite cheap price too) an amateur chemist needs for most projects.
    S3 Chemicals
    A lot of standard and also a few somewhat obscure reagents at really good prices.
    Onyxmet
    Has a lot of elements and obscure reagents that are otherwise hard to get for amatuers like NaBH4, etc. Not a lot of chemicals though.
    Laborladen
    Does really not have a lot of chemicals, but very cheap metals.
    Warchem
    Has a lot of reagents, which are also available in smaller quantities. Is also really cheap. Though they only sell to poland.
    Possibly Lerochem
    Has really cheap common chemicals.
    .. but I need to hear some other reviews for the place first.
    Hadron Scientific
    Has really cheap common chemicals, and a few obscure ones.

    There are more, but I feel this is the best to start with anyway.

    SuperOxide - 11-2-2025 at 09:49

    Quote: Originally posted by Maui3  
    This sounds like a great idea!

    I will start working on all of this (setting up github, coding, listing website, etc.)!

    For the list of websites, I can list the european ones, as I am from Europe. I do not know enough about where to buy in North America (or other places) to make a list for that. But this page could be helpful for that: https://www.sciencemadness.org/smwiki/index.php/Lab_supplier...

    For the european ones, this is what I've got:

    Laboratoriumdiscounter
    Pretty much everything (at a quite cheap price too) an amateur chemist needs for most projects.
    S3 Chemicals
    A lot of standard and also a few somewhat obscure reagents at really good prices.
    Onyxmet
    Has a lot of elements and obscure reagents that are otherwise hard to get for amatuers like NaBH4, etc. Not a lot of chemicals though.
    Laborladen
    Does really not have a lot of chemicals, but very cheap metals.
    Warchem
    Has a lot of reagents, which are also available in smaller quantities. Is also really cheap. Though they only sell to poland.
    Possibly Lerochem
    Has really cheap common chemicals.
    .. but I need to hear some other reviews for the place first.
    Hadron Scientific
    Has really cheap common chemicals, and a few obscure ones.

    There are more, but I feel this is the best to start with anyway.


    What luck, none of the ones you sent me had API's, lol. But heres a quick analysis of each, and how I would go about doing it. Some of them simply keep the price in a <meta> tag, which makes getting it very easy.

    1. Laboratoriumdiscounter: [Easy] - Just get to the right product page, then look for a meta tag with the property og:price:amount, and grab the content of that tag.
    2. Onyxmet: [Easy] - The product pages have the price is in its own <h3> tag with the class product-price.
    3. Laborladen: [Medium] - Pretty messy price formatting. No easy ID's or classes that only apply to the prices.
    4. Warchem: [Easy] - There are a few ways to get the price from here. On the products page, it's stored in a meta tag (similar to Laboratoriumdiscounter) with the property name product:price:amount; several <input> elements with the IDs parametry and InputCenaKoncowaBrutto, as well as a few other places (some JS variables).
    5. Lerochem: [Easy] - The product pages have the price in a <div> tag with the class current-price
    6. HadronScientific: [Medium] - Search kinda sucks, and the price is in a badly formed HTML table. But it looks like the price is stored in the element with the .column-3 class name (from the product pages I looked at). This might make it easier.

    chempyre235 - 11-2-2025 at 10:57

    Quote: Originally posted by Maui3  
    For the list of websites, I can list the european ones, as I am from Europe. I do not know enough about where to buy in North America (or other places) to make a list for that.


    All the sites I listed earlier in the thread are based in the US. The SM wiki lists some others as well.

    You're doing an excellent job, by the way. It looks like the software is coming together!

    [Edited on 2/11/2025 by chempyre235]

    bnull - 11-2-2025 at 11:20

    Sites may change from time to time, the code changing along with them. I recommend you inspect them occasionally to make sure your code is not outputting something else. Color codes, for example, or gibberish.

    SuperOxide - 11-2-2025 at 12:46

    Quote: Originally posted by bnull  
    Sites may change from time to time, the code changing along with them. I recommend you inspect them occasionally to make sure your code is not outputting something else. Color codes, for example, or gibberish.


    I was going to suggest the same thing. Since each site would have its own module, there could be a verify_continuity() method that makes sure the elements that are usually there are still present. Could also work for REST endpoints but that's probably less of an issue.

    SuperOxide - 11-2-2025 at 20:35

    Something else to think about - I like your idea of using the sitemap.xml, but its worth noting that the sitemap file can be named pretty much anything. But usually the sitemap filename is in the robots.txt (which does need to be there for the sitemap to be found by the search engines).

    Using Carolina Chemical again as an example, looking at their robots.txt, at the very bottom you would see:
    Quote:
    Sitemap: https://www.carolina.com/cbs-site-index.xml

    You can visit this in your browser and see that there's several sitemap files, one of which is the cbs-product-sitemap.xml which looks pretty useful. You can visit this in your browser as well (viewing it in your developer tools Elements pane makes it a lot easier to read, btw). But this only seems to contain the links, update frequency and priority for each URL. That might be helpful if you could find the last time it was updated, but I don't see where that is.

    But the tricky part is that some websites don't want you to access them through anything but an actual browser. If you curl the sitemap file in the command line you'll get back a default response saying you need to enable javascript to view the page. This is usually checked for on the server side by looking at your User Agent value and making sure its a valid browser. This can typically be circumvented by just viewing the request in your browsers Network tab, right clicking on it and selecting "Copy as cURL". This should copy every header, coolie and parameter that was used to make the request from your browser....

    Only, it doesn't seem to work for Carolina:

    If you look at the responses, youll see it sets some data in a dd variable, then loads a javascript file which seems to be doing the cloaking. I see its doing something with an iframe.. But I would think that if there was an iframe, I would be able to see it.

    Point is - Some websites are going to have roadblocks like this that will slow things down quite a bit. So expect to have some unexpected fun along the way. lol

    P.S. Carolina left developer keys in the open (just look for "key"), lol. Hopefully those aren't actual access keys.

    P.S.S. Im noticing for Carolina.com, if I open a new incognito window and go to their website, it first will prompt for a captcha. I'm not sure how this could be circumvented from the command line. I hope not too many sites are like this.

    [Edited on 12-2-2025 by SuperOxide]

    Maui3 - 13-2-2025 at 02:51

    Thank you all, this sounds good!

    SuperOxide, It looks very nice with S3 Chemicals and Laboratoriumdiscounter, but for Onyxmet and the beautifulsoup, it says this?

    I presume this isn't great, lol.

    SuperOxide - 13-2-2025 at 03:56

    Quote: Originally posted by Maui3  
    Thank you all, this sounds good!

    SuperOxide, It looks very nice with S3 Chemicals and Laboratoriumdiscounter, but for Onyxmet and the beautifulsoup, it says this?

    I presume this isn't great, lol.

    I don't get any of those. Can you still visit the website in your browser? If not, they blocked you for sending too many suspicious requests. Youll probably be unblocked in a day or so. But I'm guessing they're using some logic to determine if you're crawling the website/API's (which you are), and blocking you.

    Try doing what I did earlier (in this video):

    1. Open up developer tools in your browser (In Chrome/Brave, its at View > Developer > Developer Tools)
    2. Go to the Network tab, click Preserve Log
    3. In the same window, try to perform an action that will trigger the call you want to make in your app. (This is easier if you filter it to only show Fetch/XHR and Doc requests)
    4. When you see the XHR or Doc call in the network tab, right click on it > Copy > Copy as cURL
    5. Go to curlconverter, paste the cURL request and select Python. You should end up with something like this.
    6. Try to copy/paste that to a local script. Remove any session specific cookies. Run it.
    7. Use the BeautifulSoup thing on the result output

    Let me know if that works out.

    Once that works, see if you can take a short cut and just use a python library to spoof a browser by using something like curl_cffi.

    And if you send _too_ many curl requests, they may block you as a spammer or a bot. I would recommend doing a few requests you want, save the responses to a separate local file. Then in your code, stub (mock) the responses from the remote server by just importing/including the downloaded file. Then you can continue on as if that's a real response. Once your code is ready to be tested, remove the stub and run it.

    Feel free to share the code on Github so I can check it out.

    P.S. Maybe we should move this to a private chat, so we don't keep filling up the thread with technical stuff and end up in detritus, lol. Create a Discord account if you don't have one and PM me your username.

    [Edited on 13-2-2025 by SuperOxide]

    SuperOxide - 13-2-2025 at 04:52

    I updated the gist to include a customized python3 script that sends a product search query using the CAS on Onyxmet, then grabs the URL for the first result and curl's that page for the actual product details. Try running BeautifulSoup on the product_response variable at the bottom.
    Screenshot in the attachment:
    Attachment: php0FeCXO (498kB)
    This file has been downloaded 34 times

    P.S. To the mods - why can I never get attached images to insert as images into the post body? I always have to upload to imgur then include from there >_<

    [Edited on 13-2-2025 by SuperOxide]

    bnull - 13-2-2025 at 05:03

    Use HTTrack to save a copy of the site. You don't need the pictures, only the code, and HTTrack will preserve the structure.

    I suppose that, as long as the discussion is going somewhere, there's no risk of it going to Detritus. It has been interesting, at least.

    One more thing: the main advantage of it being a public discussion is that other programmers may chip in and offer suggestions, something that is not so easy in private. A middle ground would be moving it to a member-only area. In any case, only members can contribute to the discussion.

    SuperOxide - 13-2-2025 at 05:14

    I updated the working_requests_example.py script to even get the price from the product page using BeautifulSoup.



    Attachment: phpWiDJG0 (430kB)
    This file has been downloaded 32 times


    SuperOxide - 13-2-2025 at 05:17

    Quote: Originally posted by bnull  
    Use HTTrack to save a copy of the site. You don't need the pictures, only the code, and HTTrack will preserve the structure.


    HTTrack looks a little overkill. He does't want to crawl the entire website. He just wants to search for a product and then curl that page. It'll be 2 requests, maybe 3, sometimes even just 1.

    bnull - 13-2-2025 at 06:48

    Never mind.

    Maui3 - 13-2-2025 at 07:03

    Great Superoxide!

    I added the code you wrote for Onyxmet to mine, and now it works!
    Here is a video:
    https://i.imgur.com/7ITFNZl.mp4

    I will send it to you soon, I just need to add more comments - which I am not very good at..

    Also, for the laboratoriumdiscounter and S3 chemicals, I only use beautifulsoup to get the HTML..
    We will also need to add a "quantity" for some of them, since they might not be specified in the title. For laboratoriumdiscounter, sometimes they do, other times they dont. They really make it easy for us, lol..

    SuperOxide - 13-2-2025 at 07:24

    Quote: Originally posted by Maui3  
    Great Superoxide!
    I added the code you wrote for Onyxmet to mine, and now it works!
    Here is a video:
    https://i.imgur.com/7ITFNZl.mp4

    Well done! I'm a big nerd so I kinda prefer command line tools like that to web clients or GUI's. But that's just me. It does look great though.

    Quote: Originally posted by Maui3  
    Great Superoxide!
    I will send it to you soon, I just need to add more comments - which I am not very good at..

    ok, Did you create a Github account/repo yet? It should be very quick. Itll be a heck of a lot easier than sending zip files full of code back and fourth, lol.

    Quote: Originally posted by Maui3  

    Also, for the laboratoriumdiscounter and S3 chemicals, I only use beautifulsoup to get the HTML..
    We will also need to add a "quantity" for some of them, since they might not be specified in the title. For laboratoriumdiscounter, sometimes they do, other times they dont. They really make it easy for us, lol..

    Honestly, even if the quantity is in the title, I would only use it as a last resort. That's likely an unstandardized format that isn't reliably parsable. I would always go with grabbing the real value out of the page/response somehow. It shouldn't be too much more difficult than finding the price, but you need to find the quantity element relative to the price location, if possible.
    I realize on sites like Onyxmet you might not be able to, so you'd just have to grab it from the h3.product-title > a element, but lets test that out first.

    Search on Onyxmet for something, anything that will bring up some items (I searched for Zinc), and go to the search results page. Then open up your Javascript console (in devtools), and paste this:
    Quote:

    console.log(Array.from(document.querySelectorAll('.product-details > .caption > h4 > a')).map(elem => elem.innerHTML).join('\n'))

    If you look through that list, youll see what I mean by non-standardized values. A few of the odd ones include:

    1. Zinc 99,995% - macro etched
    2. Zinc 99,999% - 129g SOLD!!!!
    3. Zinc 99,9999% - 17g SOLD!!!!!!!!!!!!
    4. Zinc acetate dihydrate 100g

    You can see not all of these are in the same format. So what you would do then is copy that list out of the console output, go to regex101.com and try to come up with a pattern that will match as many as you can. here's an exampleI just came up with. You can see it matches the product name, quantity and even units into separate groups. It accounts for some of the odd characters and unreliable format. Hope it helps.

    [Edited on 13-2-2025 by SuperOxide]

    Maui3 - 13-2-2025 at 10:01

    I have made a github repo for it now!

    I don't know if it is possible, but can I add you as a co-owner? If that is a thing, lol.

    That would mean be both could edit the code, right?

    Also, I have not made the comments better, or structured the code a lot better yet, I'll do that, I just wanted to upload the code now.

    SuperOxide - 13-2-2025 at 11:30

    Quote: Originally posted by Maui3  

    I don't know if it is possible, but can I add you as a co-owner? If that is a thing, lol.

    I think if you edit the repo, click on Collaborators, and search for me (jhyland87), you should be able to add me. I haven't done that before either though.

    Maui3 - 14-2-2025 at 04:38

    I have added you now as a collaborator.

    Also, it was difficult to upload the code - the folders didn't upload.. I need to fix that..

    SuperOxide - 14-2-2025 at 06:03

    Quote: Originally posted by Maui3  
    I have added you now as a collaborator.

    Also, it was difficult to upload the code - the folders didn't upload.. I need to fix that..

    That's very simple. Did you read/watch what I linked you to earlier? It should be like 5 minutes to read/watch, and youll see what I mean.

    Quote: Originally posted by SuperOxide  

    But, first things first. Do you use Git (revision control)? If not, start using it. Sign up on Github.com (free), create a repository for this project, then install git on your local machine and commit some code to it. Start checking in your changes so you don't lose any of your files or anything.
    - Install git
    - Create a repo and add some code to it


    In the 2nd link (starting at 0:29), you can see how he adds his local code to it.

    Alternatively, you can download VisualStudio Code, which is what hes using in that video, and instead of doing it via the CLI, you can just select "Clone github repo, then give it the git repo URL, it checks it out, and you add your code and commit/push.
    Attachment: phplY2wEm (1.3MB)
    This file has been downloaded 35 times

    I have to work now, but maybe we can set up some time to hop on a video conference call or something and I can walk you through it.



    [Edited on 14-2-2025 by SuperOxide]

    SuperOxide - 24-2-2025 at 07:26

    If anyone was interested in an update, Maui3 and I are still working on this project and its actually coming along very well. I'm helping organize the backend and add the basic supplier modules, hes doing the UI, fixing issues I missed in the supplier modules and adding other functionality/logic.

    Here's the repo for it: YourHeatingMantle/ChemPare.

    For the supplier modules, so far we have:

    1. 3schem
    2. chemsavers
    3. esdrei (aka: S3 chem)
    4. laballey
    5. labchem
    6. laboratoriumdiscounter
    7. loudwolf
    8. onyxmet
    9. synthetika
    10. tcichemicals

    And how it works is each supplier module is an extension of the abstract base_module which contains a common interface. So regardless of how messy the logic is to get the data from the supplier, its all encapsulated behind a common interface.

    This allows us to use a factory pattern (search_factory.py) that handles executing the search for each module. It just looks at what suppliers there are in the folder, includes them, execute the search and combine the results.

    Still a bit to go before its fully ready for people to try out, but it's definitely coming along great.

    Room for another?

    imidazole - 6-3-2025 at 10:34

    I'm an okay programmer, and I sent this post from Linux, are you looking for more hands?

    SuperOxide - 9-3-2025 at 08:24

    Quote: Originally posted by imidazole  
    I'm an okay programmer, and I sent this post from Linux, are you looking for more hands?


    Well, this is meant to be an open source project, so why not :-)
    Just follow the How To Contribute doc on Github.

    But basically, it'll be:

    1. Login to your Github account and go to the ChemPare repo
    2. Fork the repository (Github doc on how to do that)
    3. Go to your repo and select "Contribute" -> "Open Pull Request" (Doc on that)

    I too am originally a Linux engineer, but I mostly do software development for work now. Hopefully you have some Python experience, but if not, this is a great project to learn on.