import requests
import gzip
from bs4 import BeautifulSoup


def href_in_gz(link):
    """
    Returns all application hyperlinks in the xml.gz link
    - link: the xml.gz link to get all application hyperlinks
    >>> link = 'https://apkpure.com/sitemaps/art_and_design-2.xml.gz'
    >>> xml_hrefs = href_in_gz(link)
    >>> xml_hrefs[0]
    'https://m.apkpure.com/art-what/com.tradefwd.ArtWhat'
    """
    resp = requests.get(link)
    data = gzip.decompress(resp.content)
    soup = BeautifulSoup(data, features='lxml')
    xml_hrefs = [l.get_text().replace('apkpure.com', 'm.apkpure.com') for l in soup('loc')]
    return xml_hrefs