Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raulil/yle-teletext-scraper
Retrieve teletext pages from Finnish Broadcasting Company.
https://github.com/raulil/yle-teletext-scraper
finnish-broadcasting-company scraper teletext yle yleisradio
Last synced: about 5 hours ago
JSON representation
Retrieve teletext pages from Finnish Broadcasting Company.
- Host: GitHub
- URL: https://github.com/raulil/yle-teletext-scraper
- Owner: RauliL
- License: mit
- Created: 2024-10-03T17:47:08.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-10-03T17:56:00.000Z (about 1 month ago)
- Last Synced: 2024-11-06T06:42:59.484Z (10 days ago)
- Topics: finnish-broadcasting-company, scraper, teletext, yle, yleisradio
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yle teletext scraper
Scrapes [teletext] pages from [Finnish Broadcasting Company] and returns their
contents as plain text.Can be used as a command line utility, [Node.js] library or in a browser.
[teletext]: https://en.wikipedia.org/wiki/Teletext
[Finnish Broadcasting Company]: https://en.wikipedia.org/wiki/Yle
[Node.js]: https://nodejs.org## Installation
```
$ npm install --save yle-teletext-scraper
```## Usage
### Command line utility
If you install this package [globally] you can use command `yle-teletext` to
retrieve pages and display them in your console.```bash
$ yle-teletext [page = 100] [subpage = 1]
```[globally]: https://docs.npmjs.com/downloading-and-installing-packages-globally
### Library
The library exports a single function called `get`, which retrieves an teletext
page, it's subpages (optionally) and so on. It's TypeScript type declaration
looks like this:```typescript
get(
page: number = 100,
subpage: number = 1,
fetchSubPages: boolean = true,
) => Promise;
```It returns an array of subpages which each containing text only version of the
page contents. If the page does not exist, or some other network related error
occurs, the promise will fail.And this is how you can use it:
```javascript
import { get } from 'yle-teletext-scraper';get(100, 1)
.then((pages) => {
pages.forEach((page) => {
console.log(page);
});
})
.catch((error) => {
console.error(error);
});
```