human
I am working on the file "HTML_and_JSON_processing.ipynb".
The first task is:
The goal of this second parser is to get content from paragraph with class: major_content.
Can you write Python program for it?
assistant
#Here is the Python program you requested.

class Test2HTMLParser(HTMLParser):

    def __init__(self):
        HTMLParser.__init__(self, convert_charrefs=True)
        self.recording = False
    
    def handle_starttag(self, tag, attrs):
        if tag == "p" and "major_content" in dict(attrs).values():
            self.recording = True

    def handle_endtag(self, tag):
        self.recording = False

    def handle_data(self, data):
        if self.recording:
            print(data)

# instantiate the parser and fed in some HTML
parser2 = Test2HTMLParser()
parser2.feed(sample_html)