https://github.com/beatfactor/fontparser
Display all the font families in use by a specified website
https://github.com/beatfactor/fontparser
docker docker-compose expressjs nodejs webdriver
Last synced: 3 months ago
JSON representation
Display all the font families in use by a specified website
- Host: GitHub
- URL: https://github.com/beatfactor/fontparser
- Owner: beatfactor
- Created: 2019-06-24T22:56:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:50:02.000Z (over 3 years ago)
- Last Synced: 2025-08-25T08:35:09.204Z (10 months ago)
- Topics: docker, docker-compose, expressjs, nodejs, webdriver
- Language: JavaScript
- Homepage:
- Size: 343 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FontParser
A Node.js and Webdriver powered API service which displays the font families in use on a specified website. Uses Docker with docker-compose.
## Introduction
The API service is built with `express` and uses Mozilla's [Webdriver](https://www.w3.org/TR/webdriver1/) compatible service [Geckodriver](https://github.com/mozilla/geckodriver).
Webdriver is a W3C specification for defining a common interface that a browser should expose for automation purposes.
The Geckodriver service runs inside a docker container, together with the Firefox browser.
### Operation
The API service runs side-by-side with the Geckodriver service. The API service sends commands to a Firefox browser via HTTP, through the Geckodriver service.
### Loading a URL
The API service first loads the desired URL in Firefox and then starts traversing the DOM nodes.
Traversing is possible by either performing a __depth-first__ search (DFS) or a __breadth-first__ search (BFS).
This is specified using the `mode` query string parameter.
### API
#### __`GET /parseFonts`__
__Params:__
- `url` - the url to load
- `mode` - can be either `dfs` (default) or `bfs`
## Building
The FontParser service requires [Docker](https://www.docker.com/) with __docker-compose__ to be installed.
Clone the project, build and run with docker-compose.
```sh
$ docker-compose build
$ docker-compose up
```
The service is running at `http://localhost:3100/parseFonts`.
## Example
```sh
$ curl http://localhost:3100/parseFonts?url=http://test_server:9100
```
## Running the tests
The tests contain a test service. There is also a test compose file which runs the test server together with the other services.
First build the test project:
```sh
$ cd apiservice
$ npm install
$ npm run build
```
Then run the tests:
```sh
$ npm test
```