Ejemplo n.º 1
0
def analysis_html(html, url_pattern, title_pattern):
    url_list = re.findall(url_pattern, html)
    title_list = re.findall(title_pattern, html)
    i = 0
    while i < len(url_list):
        url_list[i] = url_list[i]
        title_list[i] = title_list[i][7:].replace('</span>', '')
        title_list[i] = aesDecrypt('YhG78Plkl56Htrqw', title_list[i])
        i += 1
    return url_list, title_list
Ejemplo n.º 2
0
def paquindex(url, key):
    html = load_url(url)
    name_pattern = r'[te]" id="detxt">.{10,100}</span>'
    url_pattern = r'listde.php\?act=list&aid=[0-9]{2,3}'
    name_list = re.findall(name_pattern, html)
    url_list = re.findall(url_pattern, html)
    i = 0
    while i < len(url_list):
        url_list[i] = url_list[i].replace('"', '')
        name_list[i] = name_list[i][14:].replace('</span>', '')
        name_list[i] = aesDecrypt(key, name_list[i])
        nameArray.append(name_list[i])
        urlArray.append(url_list[i])
        i += 1
Ejemplo n.º 3
0
def paqu(url, filepath, name, tag, insertSql ):
    key = 'YhG78Plkl56Htrqw'
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'
    }
    reponse = requests.get(url, headers=headers)
    time.sleep(1)
    txt = reponse.content.decode("utf-8", errors="ignore")
    if 'Warning' in txt:
        tag = False
        return tag
    img = txt[txt.find(' = "') + 4:]
    img = aesDecrypt(key, img)
    if not os.path.exists(filepath):
        os.makedirs(filepath)
    with open(filepath+'/'+name + '.png', 'wb') as f:
        f.write(base64.b64decode(img))
        insertsql(insertSql)
    return tag