Repository: youtube-dl
Issue:  i want you to fix mashable website extractor
Labels: site-support-request

<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2021.02.10. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that site you are requesting is not dedicated to copyright infringement, see https://yt-dl.org/copyright-infringement. youtube-dl does not support such sites. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
- Search the bugtracker for similar site support requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
- Finally, put x into all relevant boxes (like this [x])
-->

- [x] I'm reporting a new site support request
- [x] I've verified that I'm running youtube-dl version **2021.02.10**
- [x] I've checked that all provided URLs are alive and playable in a browser
- [x] I've checked that none of provided URLs violate any copyrights
- [x] I've searched the bugtracker for similar site support requests including closed ones


## Example URLs

<!--
Provide all kinds of example URLs support for which should be included. Replace following example URLs by yours.
-->

- Single video: https://www.youtube.com/watch?v=BaW_jenozKc
- Single video: https://youtu.be/BaW_jenozKc
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc


## Description

<!--
Provide any additional information.
If work on your issue requires account credentials please provide them or explain how one can obtain them.
-->

WRITE DESCRIPTION HERE



hello I have coded mashable extractor can you fix it from my code 

`def get_mashable_result(url):

    url = 'https://mashable.com/video/covid-vaccine-pfizer-moderna-explainer/'

    payload = {}
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36'
    }

    mytext = requests.request("GET", url, headers=headers, data=payload)

    # print(response.text)
    newtext = html.unescape(mytext.text)

    output = re.search(
        '(?s)<script class="playerMetadata" type="application/json">(.*?)</script>', newtext, flags=re.IGNORECASE)
    if output is not None:
        output = output.group(0)
        str_start = output.index('type="application/json">')
        str_end = output.index('</script>')
        jsonStr = json.loads(output[str_start + 24:str_end])
        # print(jsonStr)

    strinjsonDummyStart = "{\"url\":\"" + url + "\",\"videos\":[{\"age_limit\":0,\"thumbnail\":\"" + jsonStr["player"]["image"] + \
        "\",\"display_id\":\"https:\/\/blueprint-api-production.s3.amazonaws\",\"ext\":\"com\",\"extractor\":\"generic\",\"extractor_key\":\"Generic\",\"format\":\"0 - unknown\",\"format_id\":\"0\",\"formats\":["

    strinjsonDummyEnd = "],\"http_headers\":{\"Accept\":\"text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8\",\"Accept-Charset\":\"ISO-8859-1,utf-8;q=0.7,*;q=0.7\",\"Accept-Encoding\":\"gzip, deflate\",\"Accept-Language\":\"en-us,en;q=0.5\",\"Cookie\":\"gdpr_location=true\",\"User-Agent\":\"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/68.0.3440.122 Safari\/537.36\"},\"id\":\"https:\/\/blueprint-api-production.s3.amazonaws\",\"n_entries\":5,\"playlist\":\"\",\"playlist_id\":\"\",\"playlist_index\":1,\"playlist_title\":\"\",\"playlist_uploader\":\"\",\"playlist_uploader_id\":\"\",\"protocol\":\"https\",\"requested_subtitles\":\"\",\"title\":\"What you need to know about the COVID-19 vaccine (1)\",\"uploader\":\"mashable.com\",\"url\":\"https:\/\/mashable.com\/video\/covid-vaccine-pfizer-moderna-explainer\/https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com\",\"webpage_url\":\"https:\/\/mashable.com\/video\/covid-vaccine-pfizer-moderna-explainer\/?europe=true\",\"webpage_url_basename\":\"covid-vaccine-pfizer-moderna-explainer\"}]}"

    mydataStr = ''
    jarray = jsonStr["player"]["sources"]

    for jdata in jarray:
        if ".mp4" in jdata['file']:
            mydataStr = mydataStr + \
                "{\"ext\":\"unknown_video\",\"format\":\"hd\",\"format_id\":\"0\",\"http_headers\":{\"Accept\":\"text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8\",\"Accept-Charset\":\"ISO-8859-1,utf-8;q=0.7,*;q=0.7\",\"Accept-Encoding\":\"gzip, deflate\",\"Accept-Language\":\"en-us,en;q=0.5\",\"User-Agent\":\"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/68.0.3440.122 Safari\/537.36\"},\"protocol\":\"https\",\"url\":\"" + jdata[
                    'file'] + "\"},"

    return json.loads(strinjsonDummyStart + mydataStr + strinjsonDummyEnd)`



[mashable_code.txt](https://github.com/ytdl-org/youtube-dl/files/5994042/mashable_code.txt)