Skip to content

Uses webscraping to take and url and create a label for the bottle.

License

Notifications You must be signed in to change notification settings

chakeson/Systembolaget-Labelmaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Systembolaget-Labelmaker

Uses webscraping to take and url and create a label for the bottle. Preview of program

Purpose

My parent make labels for their wine bottles to know what the wine fits with and what it contains and some other information. This program automates this process.

Build instructions

The py installer spec was created with:

pyi-makespec Systembolaget_Label.py --onefile

To create the executable run the following command in the src folder:

pyinstaller --clean Systembolaget_Label.spec

--clean ensures all temporary files and caches are removed before building the executable.

How does it work?

It takes URL's in an input.txt (creates it if missing) and sorts the real URL's with regular expressions. These validated URLs are then fetched with selenium, and then parsed with beautifulsoup4 for the data which is put into a wine class. It is then written to and output.txt and output.docx file.

Code

Code was formated by python black. Python-docx for creating the word document for print out ontop of output.txt Uses selenium to scrape it since it allows for running of the Javascript to populate the page. The site is based on Next Js.Uses the built-in html parser.

Testing

We test with three wines to catch most cases.

256601 for a wine without full name.

225701 a wine with multiple bottle types.

626301 wine with higher price and diffrent location data, non integer alcohol procentage.

Notes

This uses the chromium webdriver because the firefox one has alot of small edges and versions which are incompatible with selenium. Thus using the chromium webdriver I saved alot of time and effort. It quite frankly seems like the chromium one is getting all the attantion and developer time. The webdriver is downloaded and handled by the webdriver managment library. For a manual set up get the lastest chromium driver download it here

Upgrades for next version

Add GUI

TODO

Split out constants

Create tests

Consider adding python black in with a github action

About

Uses webscraping to take and url and create a label for the bottle.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages