-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for freecodecamp scraper
- Loading branch information
Showing
6 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
dispatcher/backend/src/common/schemas/offliners/freecodecamp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
from marshmallow import fields | ||
|
||
from common.schemas import SerializableSchema | ||
from common.schemas.fields import ( | ||
validate_output, | ||
validate_zim_description, | ||
validate_zim_filename, | ||
validate_zim_longdescription, | ||
) | ||
|
||
|
||
class FreeCodeCampFlagsSchema(SerializableSchema): | ||
class Meta: | ||
ordered = True | ||
|
||
course = fields.String( | ||
metadata={ | ||
"label": "Course(s)", | ||
"description": "Course or course list (separated by commas)", | ||
}, | ||
required=True, | ||
) | ||
|
||
language = fields.String( | ||
metadata={ | ||
"label": "Language", | ||
"description": "Language of zim file and curriculum", | ||
}, | ||
required=True, | ||
) | ||
|
||
name = fields.String( | ||
metadata={ | ||
"label": "Name", | ||
"description": "ZIM name", | ||
}, | ||
required=True, | ||
) | ||
|
||
title = fields.String( | ||
metadata={ | ||
"label": "Title", | ||
"description": "ZIM title", | ||
}, | ||
required=True, | ||
) | ||
|
||
description = fields.String( | ||
metadata={ | ||
"label": "Description", | ||
"description": "Description for your ZIM", | ||
}, | ||
required=True, | ||
validate=validate_zim_description, | ||
) | ||
|
||
long_description = fields.String( | ||
metadata={ | ||
"label": "Long description", | ||
"description": "Optional long description for your ZIM", | ||
}, | ||
validate=validate_zim_longdescription, | ||
data_key="long-description", | ||
) | ||
|
||
creator = fields.String( | ||
metadata={ | ||
"label": "Content Creator", | ||
"description": "Name of content creator. “freeCodeCamp” otherwise", | ||
} | ||
) | ||
|
||
publisher = fields.String( | ||
metadata={ | ||
"label": "Publisher", | ||
"description": "Custom publisher name (ZIM metadata). “OpenZIM” otherwise", | ||
} | ||
) | ||
|
||
debug = fields.Boolean( | ||
truthy=[True], | ||
falsy=[False], | ||
metadata={"label": "Debug", "description": "Enable verbose output"}, | ||
) | ||
|
||
output_dir = fields.String( | ||
metadata={ | ||
"label": "Output folder", | ||
"placeholder": "/output", | ||
"description": "Output folder for ZIM file(s). Leave it as `/output`", | ||
}, | ||
load_default="/output", | ||
dump_default="/output", | ||
data_key="output-dir", | ||
validate=validate_output, | ||
) | ||
|
||
zim_file = fields.String( | ||
metadata={ | ||
"label": "ZIM filename", | ||
"description": "ZIM file name (based on --name if not provided). " | ||
"Include {period} to insert date period dynamically", | ||
}, | ||
data_key="zim-file", | ||
validate=validate_zim_filename, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,17 +322,17 @@ export default { | |
cancelable_statuses: cancelable_statuses, | ||
running_statuses: running_statuses, | ||
contact_email: "[email protected]", | ||
categories: ["gutenberg", "ifixit", "other", "phet", "psiram", "stack_exchange", | ||
categories: ["freecodecamp", "gutenberg", "ifixit", "other", "phet", "psiram", "stack_exchange", | ||
"ted", "openedx", "vikidia", "wikibooks", "wikihow", "wikinews", | ||
"wikipedia", "wikiquote", "wikisource", "wikispecies", "wikiversity", | ||
"wikivoyage", "wiktionary"], // list of categories for fileering | ||
warehouse_paths: ["/gutenberg", "/ifixit", "/other", "/phet", "/psiram", "/stack_exchange", | ||
warehouse_paths: ["/freecodecamp", "/gutenberg", "/ifixit", "/other", "/phet", "/psiram", "/stack_exchange", | ||
"/ted", "/mooc", "/videos", "/vikidia", "/wikibooks", "/wikihow", | ||
"/wikinews", "/wikipedia", "/wikiquote", "/wikisource", | ||
"/wikiversity", "/wikivoyage", "/wiktionary", "/zimit", | ||
"/.hidden/dev", "/.hidden/private", "/.hidden/endless", | ||
"/.hidden/bard", "/.hidden/bsf", "/.hidden/custom_apps"], | ||
offliners: ["mwoffliner", "youtube", "phet", "gutenberg", "sotoki", "nautilus", "ted", "openedx", "zimit", "kolibri", "wikihow", "ifixit"], | ||
offliners: ["mwoffliner", "youtube", "phet", "gutenberg", "sotoki", "nautilus", "ted", "openedx", "zimit", "kolibri", "wikihow", "ifixit", "freecodecamp"], | ||
periodicities: ["manually", "monthly", "quarterly", "biannualy", "annually"], | ||
memory_values: [536870912, // 512MiB | ||
1073741824, // 1GiB | ||
|