'Parses torrent url from newtorrents download page'

@plugin.internet(log)
def url_from_page(self, url):

    try:
        page = requests.get(url)
        data = page.text
    except Exception:
        raise UrlRewritingError(u'URLerror    when    retrieving    page')
    p = re.compile(u"copy\\('(.*)'\\)", re.IGNORECASE)
    f = p.search(data)
    if (not f):
        raise UrlRewritingError(u'Failed    to    get    url    from    download    page.    Plugin    may    need    a    update.')
    else:
        return f.group(1)
