Extract html content based on tags, specifically headers
Currently, you are matching a single h1 tag only, but, from what I understand, you want to catch all the "header" elements. There are multiple ways to do that. 

One is with a regular expression:

headers = soup.find_all(re.compile(r"^h"))


Or, with a lambda function:

headers = soup.find_all(lambda tag: tag and tag.name.startswith("h"))


Or, with a list of explicitly specified tags:

headers = soup.find_all(['h1', 'h2', 'h3', 'h4', 'h5'])


Note that in order to get the header texts, you would use .get_text() method:

[header.get_text() for header in headers]




Other notes:


if every item returned from tqdm(data) consists of two items, you can unpack them in a for loop:

for html, url in tqdm(data):


Then, you can use html instead of x[0] and url instead of x[1].
if you are going to go with a regular expression approach to match the headers, you should pre-compile the expression - define it as a constant:

HEADER_PATTERN = re.compile(r"^h")

you can use json.load() to read JSON from a file directly, replace:

data = json.loads(open(local_path).read())


with:

with open(local_path) as input_file:
    data = json.load(input_file)



If performance matters:


you can use a faster JSON parser: ujson instead of json
use lxml instead of html.parser as a BeautifulSoup underlying parser
you can parse header elements only with SoupStrainer ignoring all other elements - this should boost HTML parsing performance as well


Improved code (with some of the suggestions applied):

import re

from bs4 import BeautifulSoup, SoupStrainer
from tqdm import tqdm
import ujson


HEADER_PATTERN = re.compile(r"^h")


def get_headers_from_json(local_path):
    """
    The function takes a json file with html_body and returns a list of headers.
    It parses the headers, based on tags starting with 'h'.
    It also parses urls and return them in a tuple: (headers, url)
    """
    with open(local_path) as input_file:
        data = ujson.load(input_file)

    parse_only = SoupStrainer(HEADER_PATTERN)
    return [
        ([header.get_text() for header in BeautifulSoup(html, 'lxml', parse_only=parse_only)(HEADER_PATTERN)], url)
        for html, url in tqdm(data)
    ]