libingester

2.8.5

config

config
Static Members
parse_options(options)
get_setting(setting)

Hatch

Creates the hatch and parses arguments.

new Hatch(name: string, language: string, options: Object)
Parameters
name (string) A name for the ingester
language (string) ISO 3166-1 alpha-2 two-letter language code, for use in generating spelling and stopwords dictionaries for search
options (Object) [{}] - A dictionary with options. For a list of available options see config.parse_options
Instance Members
is_exporting_tgz()
get_urls()
get_language()
get_name()
get_path()
finish()
save_asset(asset)
save_failed_asset(asset)
has_failed_asset(asset)
copy_to_directory(directory)
copy_to_s3(bucket)

BaseAsset

new BaseAsset(metadata: any, verifier: any)
Parameters
metadata (any = {})
verifier (any = assetVerifier)
Instance Members
asset_id
set_metadata(metadata)
set_title(value)
set_synopsis(value)
set_thumbnail(value)
set_canonical_uri(value)
set_revision_tag(value)
set_last_modified_date(value)
set_date_published(value)
set_sequence_number(value)
set_license(value)
set_can_export(value)
set_can_print(value)
set_tags(value)
to_data()
to_hatch_manifest()
to_hatch_metadata()
get_dependent_assets()

BlogArticle

new BlogArticle(metadata: any)

Extends BaseAsset

Parameters
metadata (any = {})
Instance Members
set_metadata(metadata)
set_author(value)
set_main_image(value)
set_main_image_caption(value)
set_body(value)
set_custom_scss(value)
set_read_more_text(value)
set_tags(value)
set_as_static_page()
render()

set_metadata

Set multiple metadata at once.

set_metadata(metadata: Object)

Extends BaseAsset#set_metadata

Parameters
metadata (Object) The metadata can be:
Name Description
metadata.word string See DictionaryAsset#set_word .
metadata.definition string See DictionaryAsset#set_definition .
metadata.part_of_speech string See DictionaryAsset#set_part_of_speech .
metadata.source string See DictionaryAsset#set_source .
metadata.body (string | Cheerio) See DictionaryAsset#set_body .
metadata.custom_scss string See DictionaryAsset#set_custom_scss .
metadata.main_image ImageAsset See DictionaryAsset#set_main_image .

set_metadata

Set multiple metadata at once.

set_metadata(metadata: Object)

Extends BlogArticle#set_metadata

Parameters
metadata (Object) The metadata can be:
Name Description
metadata.temporal_coverage string See GalleryImageArticle#set_temporal_coverage .

set_metadata

Set multiple metadata at once.

set_metadata(metadata: Object)

Extends BlogArticle#set_metadata

Parameters
metadata (Object) The metadata can be:
Name Description
metadata.main_video string See GalleryVideoArticle#set_main_video .

ImageAsset

new ImageAsset(metadata: any)

Extends BaseAsset

Parameters
metadata (any = {})
Instance Members
set_metadata(metadata)
set_image_data(contentType, imageData)

NewsArticle

new NewsArticle(metadata: any)

Extends BaseAsset

Parameters
metadata (any = {})
Instance Members
set_metadata(metadata)
set_authors(value)
set_main_image(asset, caption?)
set_section(value)
set_as_static_page()
set_source(value)
set_lede(value)
set_body(value)
set_custom_scss(value)
render()

DocumentAsset

new DocumentAsset(metadata: any)

Extends BaseAsset

Parameters
metadata (any = {})

VideoAsset

new VideoAsset(metadata: any)

Extends BaseAsset

Parameters
metadata (any = {})
Instance Members
set_metadata(metadata)
set_download_uri(value)
to_hatch_manifest()
to_hatch_metadata()

VideoArticle

A simple wrapper over VideoAsset that should be used for toplevel videos.

This asset type is for videos that aren't embedded as part of another piece of content, but should instead be directly accessible from content listings and search results. For instance, if you were building an app where the only content was videos and those videos required no other context other than some displayable metadata such as the authors and a brief synopsis, then you should use this asset type.

In the past, developers used GalleryVideoArticle, which wrapped the video in another HTML page. That asset type is now deprecated since apps are capable of displaying the video and its corresponding metadata correctly without the need for a page in between.

new VideoArticle()

Extends VideoAsset

Instance Members
set_metadata(metadata)
set_author(value)

util

util
Static Members
fetch_html(uri, encoding?)
fetch_news_article(hatch, uri, encoding?)
fetch_blog_article(hatch, uri, encoding?)
get_doc_base_uri(doc, baseUri)
get_embedded_video_asset(videoTag, videoUri)
download_image(uri)
download_youtube_thumbnail(embedUrl)
download_img($img, baseUri)
get_ingestion_limits(desiredMaxItems, desiredMaxDaysOld)
fetch_rss_entries(feed, max_items, max_days_old, request_options)
create_wordpress_paginator(feed)
CLEANUP_DEFAULTS
extend_cleanup_defaults(options)
cleanup_body(body, options)