from utils import data_writer, path_builder, downloader from le_utils.constants import licenses, exercises, content_kinds, file_formats, format_presets, languages """ Additional imports """ """ Run Constants""" CHANNEL_NAME = "{{cookiecutter.channel_name}}" # Name of channel CHANNEL_SOURCE_ID = "{{cookiecutter.github_username}}" # Channel's unique id CHANNEL_DOMAIN = "{{cookiecutter.email}}" # Who is providing the content CHANNEL_LANGUAGE = "{{cookiecutter.channel_language}}" # Language of channel CHANNEL_DESCRIPTION = None # Description of the channel (optional) CHANNEL_THUMBNAIL = None # Local path or url to image file (optional) PATH = path_builder.PathBuilder(channel_name=CHANNEL_NAME) # Keeps track of path to write to csv WRITE_TO_PATH = "{}{}{}.zip".format(os.path.dirname(os.path.realpath(__file__)), os.path.sep, CHANNEL_NAME) # Where to generate zip file """ Additional Constants """ """ Main Scraping Method """ def scrape_source(writer): """ scrape_source: Scrapes channel page and writes to a DataWriter Args: writer (DataWriter): class that writes data to folder/spreadsheet structure Returns: None """ # TODO: Replace line with scraping code raise ImplementationError("Scraping method not implemented")
import zipfile from bs4 import BeautifulSoup from utils import data_writer, path_builder, downloader from le_utils.constants import licenses from ricecooker.utils.html import download_file from ricecooker.utils.zip import create_predictable_zip """ Run Constants""" ########################################################### CHANNEL_NAME = 'Example Wikipedia' # Name of channel CHANNEL_SOURCE_ID = 'souschef-example-learningequality' # Channel's unique id CHANNEL_DOMAIN = 'en.wikipedia.org' # Who is providing the content CHANNEL_LANGUAGE = 'en' # Language of channel CHANNEL_DESCRIPTION = '' # Description of the channel (optional) CHANNEL_THUMBNAIL = 'https://vignette2.wikia.nocookie.net/uncyclopedia/images/6/63/Wikipedia-logo.png' # Local path or url to image file (optional) PATH = path_builder.PathBuilder(channel_name=CHANNEL_NAME) WRITE_TO_PATH = "{}{}{}.zip".format(os.path.dirname( os.path.realpath(__file__)), os.path.sep, CHANNEL_NAME) # Where to generate zip file """ Additional Constants """ ########################################################### BASE_URL = 'https://en.wikipedia.org/wiki' # Set up logging tools LOGGER = logging.getLogger() __logging_handler = logging.StreamHandler() LOGGER.addHandler(__logging_handler) LOGGER.setLevel(logging.INFO) # License to be used for content under channel CHANNEL_LICENSE = licenses.PUBLIC_DOMAIN