In [1]:
import logging
import os
import re
from urllib.parse import urlparse, parse_qs
import tempfile

from bs4 import BeautifulSoup
import requests

from engageny_chef import get_text, get_parsed_html_from_url, make_fully_qualified_url
from engageny_chef import LOGGER
LOGGER.addHandler(logging.StreamHandler())  # needed for logging in to work in notebook

from engageny_chef import ENGAGENY_LICENSE
from le_utils.constants import content_kinds, file_formats, licenses

import pprint
pp = pprint.PrettyPrinter(indent=4, width=100)

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [2]:
from engageny_chef import download_math_lesson

# Sample
# sample_topic_url = 'https://www.engageny.org/resource/grade-6-mathematics-module-4-topic-f-overview'
sample_lesson_url = 'https://www.engageny.org/resource/grade-6-mathematics-module-4-topic-f-lesson-18'

lesson_node = download_math_lesson(sample_lesson_url)
pp.pprint(lesson_node)


{   'children': [   {   'author': 'Engage NY',
                        'description': 'Grade 6 Mathematics Module 4, Topic F, Lesson 18: Student '
                                       'Version (442.48 KB)',
                        'files': [   {   'file_type': 'DocumentFile',
                                         'language': 'en',
                                         'path': 'https://www.engageny.org/file/44251/download/math-g6-m4-topic-f-lesson-18-student.pdf'}],
                        'kind': 'DocumentNode',
                        'language': 'en',
                        'source_id': 'https://www.engageny.org/resource/grade-6-mathematics-module-4-topic-f-lesson-18:math-g6-m4-topic-f-lesson-18-student.pdf',
                        'thumbnail': None,
                        'title': 'math-g6-m4-topic-f-lesson-18-student.pdf'},
                    {   'author': 'Engage NY',
                        'description': 'Grade 6 Mathematics Module 4, Topic F, Lesson 18: Teacher '
                                       'Version (772.46 KB)',
                        'files': [   {   'file_type': 'DocumentFile',
                                         'language': 'en',
                                         'path': 'https://www.engageny.org/file/44256/download/math-g6-m4-topic-f-lesson-18-teacher.pdf'}],
                        'kind': 'DocumentNode',
                        'language': 'en',
                        'source_id': 'https://www.engageny.org/resource/grade-6-mathematics-module-4-topic-f-lesson-18:math-g6-m4-topic-f-lesson-18-teacher.pdf',
                        'thumbnail': None,
                        'title': 'math-g6-m4-topic-f-lesson-18-teacher.pdf'}],
    'description': 'Grade 6 Mathematics           \xa0\xa0Prev  - Grade 6 Mathematics Module 4, '
                   'Topic F, Overview         Next  - Grade 6 Mathematics Module 4, Topic F, '
                   'Lesson 19',
    'kind': 'TopicNode',
    'language': 'en',
    'source_id': 'https://www.engageny.org/resource/grade-6-mathematics-module-4-topic-f-lesson-18',
    'title': 'Grade 6 Mathematics Module 4, Topic F, Lesson 18'}

Calling chef method for debugging...


In [3]:
from engageny_chef import EngageNYChef
chef = EngageNYChef()

chef_args = None
chef_options = {}
chef.scrape(chef_args, chef_options)


Finished building ricecooker_json_tree
Scraping result stored in chefdata/trees/ricecooker_json_tree.json

In [ ]: