⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newcomic2.0.pyw

📁 用python写的一个简单程序
💻 PYW
字号:
# -*- coding: GBK -*-
import urllib
import os
import time
import re

while(1):
    fp = open("infile.txt","r")
    epis = fp.readlines()
    fp.close()
    
    try:
        webpage = urllib.urlopen("http://bt.ktxp.com/sort-12-1.html")
    except:
        time.sleep(120)
        continue
    content = webpage.read()

    result = "<html> <body>"
    for i in range(0,int(epis[0].rstrip('\r\n'))):
        s = "href=.+" + epis[i*2+1].rstrip('\r\n') + ".+" + epis[i*2+2].rstrip('\r\n')
        s = s.decode('gbk').encode('utf-8')
        m = re.compile(s).search(content)
        if(m):
            torrent_page = urllib.urlopen("http://bt.ktxp.com" + m.group().split('"') [1])
            torrent_content = torrent_page.read()
            torrent_s = "href.+\.torrent"
            torrent_s = torrent_s.decode('gbk').encode('utf-8')
            torrent_m = re.compile(torrent_s).search(torrent_content)
            ##result = result + epis[i*2+1].rstrip('\r\n') + ":   " + "http://bt.ktxp.com" + torrent_m.group().split('"') [1] + "\n"
            result = result + "<a href=" + "http://bt.ktxp.com" + torrent_m.group().split('"') [1] + ">" + epis[i*2+1].rstrip('\r\n') + " " + epis[i*2+2].rstrip('\r\n') + "</a> <br><br>"
            epis[i*2+2] = str(int(epis[i*2+2].rstrip('\r\n'))+1) + '\n'
            if (int(epis[i*2+2].rstrip('\r\n'))<10):
                epis[i*2+2] = "0" + str(int(epis[i*2+2].rstrip('\r\n'))) + '\n'
                
    fp = open("infile.txt","w")
    for epi in epis:
        fp.write(epi)
    fp.close()

    if (result != "<html> <body>"):
        result = result + "</body> </html>"
        fp = open("result.html","w")
        fp.write(result)
        fp.close()
        os.system('result.html')
    time.sleep(14400)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -