Jump to content

Help on a college app project.

zarrexx

Hi, for a project in college I am to make an app which scans the barcode of a product, be it food item, medicine or toiletries, and returns a list of ingredients which contain in the product.

 

I have an idea where to start with the barcode scanning part, but have no idea how I would search and retrieve the ingredients of the product from google. (As with most cases when you google search a barcode number you get information on the product on different websites, and as different products are on different websites I have to incorporate this search into google.)

 

Thank you for any help!

 

Link to comment
Share on other sites

Link to post
Share on other sites

I would see if you can find a standardized database of such information... Scraping around on Google would be quite difficult. Retrieving HTML elements from a large database table would be much more reasonable.

Join the Appleitionist cause! See spoiler below for answers to common questions that shouldn't be common!

Spoiler

Q: Do I have a virus?!
A: If you didn't click a sketchy email, haven't left your computer physically open to attack, haven't downloaded anything sketchy/free, know that your software hasn't been exploited in a new hack, then the answer is: probably not.

 

Q: What email/VPN should I use?
A: Proton mail and VPN are the best for email and VPNs respectively. (They're free in a good way)

 

Q: How can I stay anonymous on the (deep/dark) webzz???....

A: By learning how to de-anonymize everyone else; if you can do that, then you know what to do for yourself.

 

Q: What Linux distro is best for x y z?

A: Lubuntu for things with little processing power, Ubuntu for normal PCs, and if you need to do anything else then it's best if you do the research yourself.

 

Q: Why is my Linux giving me x y z error?

A: Have you not googled it? Are you sure StackOverflow doesn't have an answer? Does the error tell you what's wrong? If the answer is no to all of those, message me.

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, LtStaffel said:

I would see if you can find a standardized database of such information... Scraping around on Google would be quite difficult. Retrieving HTML elements from a large database table would be much more reasonable.

I understand what you mean but the problem im facing is there is no standardized database which contains such information. Only the product webpage contains the product information (ingredients). If i was to scrape google, how would I go about doing so?

Link to comment
Share on other sites

Link to post
Share on other sites

38 minutes ago, zarrexx said:

I understand what you mean but the problem im facing is there is no standardized database which contains such information. Only the product webpage contains the product information (ingredients). If i was to scrape google, how would I go about doing so?

I don't even know

You'd be parsing html and dodging js loaded text and just... Did you get assigned this project specifically or did you pick it? If you have any way at all to pick a different thing, then I might look at other options. If it was assigned, then was it actually required that any item be scannable? Or is there a small dictionary/list that you can use and hardcode into your program?

Join the Appleitionist cause! See spoiler below for answers to common questions that shouldn't be common!

Spoiler

Q: Do I have a virus?!
A: If you didn't click a sketchy email, haven't left your computer physically open to attack, haven't downloaded anything sketchy/free, know that your software hasn't been exploited in a new hack, then the answer is: probably not.

 

Q: What email/VPN should I use?
A: Proton mail and VPN are the best for email and VPNs respectively. (They're free in a good way)

 

Q: How can I stay anonymous on the (deep/dark) webzz???....

A: By learning how to de-anonymize everyone else; if you can do that, then you know what to do for yourself.

 

Q: What Linux distro is best for x y z?

A: Lubuntu for things with little processing power, Ubuntu for normal PCs, and if you need to do anything else then it's best if you do the research yourself.

 

Q: Why is my Linux giving me x y z error?

A: Have you not googled it? Are you sure StackOverflow doesn't have an answer? Does the error tell you what's wrong? If the answer is no to all of those, message me.

 

Link to comment
Share on other sites

Link to post
Share on other sites

22 hours ago, LtStaffel said:

I don't even know

You'd be parsing html and dodging js loaded text and just... Did you get assigned this project specifically or did you pick it? If you have any way at all to pick a different thing, then I might look at other options. If it was assigned, then was it actually required that any item be scannable? Or is there a small dictionary/list that you can use and hardcode into your program?

No this project I picked myself, I was under assumption that it wouldnt be too hard to parse the ingredients from a webpage, but another option I have is to find a database with such contents, but the problem that I have then is it will only work for 1 shop/retailer.

Link to comment
Share on other sites

Link to post
Share on other sites

 

8 minutes ago, zarrexx said:

No this project I picked myself, I was under assumption that it wouldnt be too hard to parse the ingredients from a webpage, but another option I have is to find a database with such contents, but the problem that I have then is it will only work for 1 shop/retailer.

https://www.esha.com/products/nutrition-database-api/

 

give that a look.

 

You can access it like

 

wsdemo.esha.com/api/foods?query=burger which returns json

 

edit;

 

In python you can do

 

import requests
import json


with requests.Session() as s:
    r = s.get('http://wsdemo.esha.com/api/foods?query=burger')
    items = json.loads(r.text)
    for item in items['items']:
        print(item['description'])

 

output, not all all the items as there are pages but you get the idea.


hamburger, double
cheeseburger, jr bacon
cheeseburger, double
cheeseburger, with spread
cheeseburger, Whopper Jr
cheeseburger, double, bacon
cheeseburger, Double Double, with spread
cheeseburger, jr deluxe
hamburger, Whopper Jr
hamburger, small
hamburger, with spread
cheeseburger, with ketchup & mustard
cheeseburger, Double Double, with mustard & ketchup
cheeseburger, small
hamburger, kids'
cheeseburger
cheeseburger
cheeseburger, homestyle, GrillBurger
bun, hamburger
hamburger, homestyle, GrillBurger
hamburger, Jumbo Jack
cheeseburger, Western Bacon
cheeseburger, frozen, microwaveable
hamburger
cheeseburger, Jumbo Jack

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

On 10/9/2017 at 6:56 PM, vorticalbox said:

 

https://www.esha.com/products/nutrition-database-api/

 

give that a look.

 

You can access it like

 

wsdemo.esha.com/api/foods?query=burger which returns json

 

edit;

 

In python you can do

 


import requests
import json


with requests.Session() as s:
    r = s.get('http://wsdemo.esha.com/api/foods?query=burger')
    items = json.loads(r.text)
    for item in items['items']:
        print(item['description'])

 

output, not all all the items as there are pages but you get the idea.



hamburger, double
cheeseburger, jr bacon
cheeseburger, double
cheeseburger, with spread
cheeseburger, Whopper Jr
cheeseburger, double, bacon
cheeseburger, Double Double, with spread
cheeseburger, jr deluxe
hamburger, Whopper Jr
hamburger, small
hamburger, with spread
cheeseburger, with ketchup & mustard
cheeseburger, Double Double, with mustard & ketchup
cheeseburger, small
hamburger, kids'
cheeseburger
cheeseburger
cheeseburger, homestyle, GrillBurger
bun, hamburger
hamburger, homestyle, GrillBurger
hamburger, Jumbo Jack
cheeseburger, Western Bacon
cheeseburger, frozen, microwaveable
hamburger
cheeseburger, Jumbo Jack

 

I understand what you mean but in my case that database wouldn't work. I have already found a solution to my problem, I have contacted local retailers asking them to access their databases and so far Tesco replied, which is a great start and I can given basing my project off that.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×