New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

nrk-sapmi-crawler

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nrk-sapmi-crawler

Crawler for NRK Sapmi news bulletins that will be the basis for Sami stopword lists and an example search engine for content in Sami.

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
7
133.33%
Maintainers
1
Weekly downloads
 
Created
Source

nrk-sapmi-crawler

NPM version NPM downloads tests MIT License

Crawler for NRK Sapmi news bulletins that will be the basis for stopword-sami and an example search engine for content in Sami.

Crawl news bulletins in Northern Sami, Lule Sami and South Sami.

Code is not the cleanest one, but it works well enough, and hopefully will without too much maintenance for the next copule of years. If you just want the datasets, install stopword-sami modul.

Getting a list of article IDs to crawl

import { getList, crawlHeader, readIfExists, calculateIdListAndWrite } from '../index.js'

const southSami = {
 id: '1.13572943',
 languageName: 'Åarjelsaemien',
 url: 'https://www.nrk.no/serum/api/content/json/1.13572943?v=2&limit=1000&context=items',
 file: './lib/list.southSami.json'
}

// Bringing it all together, fetching URL and reading file, and if new content -> merging arrays and writing
Promise.all([getList(southSami.url, crawlHeader), readIfExists(southSami.file).catch(e => e)])
 .then((data) => {
   calculateListAndWrite(data, southSami.id, southSami.file, southSami.languageName)
 })
 .catch(function (err) {
   console.log('Error: ' + err)
 })

To change user-agent for the crawler

crawlHeader['user-agent'] = 'name of crawler/version - comment (i.e. contact-info)'

Getting the content from a list of IDs

import { crawlContentAndWrite } from 'nrk-sapmi-crawler'
const appropriateTime = 2000

const southSami = {
  idFile: './datasets/list.southSami.json',
  contentFile: './datasets/content.southSami.json'
}


async function crawl () {
  await crawlContentAndWrite(southSami.idFile, southSami.contentFile, appropriateTime)
}

crawl()

Keywords

nlp

FAQs

Package last updated on 24 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts