欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python制作CSDN免積分下載器

 更新時間:2015年03月10日 11:15:56   投稿:hebedich  
本文給大家分享的是使用python實現(xiàn)的CSDN的免積分下載器,具體干嘛的,我相信你懂的~~~有需要的小伙伴自己來看看哈。

CSDN免積分下載 你懂的。
1、輸入資源地址如:http://download.csdn.net/download/gengqkun/4127808
2、輸入驗證碼
3、點擊下載,會彈出瀏覽器下載。
注:成功率在70-80% ,界面很丑,請將就著用。

復制代碼 代碼如下:

#-*-coding:utf-8-*-
#python3.3.5
import urllib.parse,urllib.request,http.cookiejar,io,webbrowser
import tkinter as tk
from tkinter import *
from tkinter.ttk import *
from urllib.request import urlopen
from PIL import Image, ImageTk
global root
#設(shè)置cookie 
cookie = http.cookiejar.CookieJar()
cookieProc = urllib.request.HTTPCookieProcessor(cookie)
opener = urllib.request.build_opener(cookieProc)
urllib.request.install_opener(opener)
#根據(jù)路徑和POST內(nèi)容來提交表單
def getUrlRequest(iUrl,iStrPostData):
    postdata = urllib.parse.urlencode(iStrPostData)
    postdata = postdata.encode(encoding='UTF8')
    header = {'User-Agent':'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)'}
    req= urllib.request.Request(
               url = iUrl,
               data = postdata,
               headers = header)
    data = urllib.request.urlopen(req).read()
    try:
        data = data.decode('utf-8')
    except:
        data = data.decode('gbk', 'ignore')
    return data
#獲取驗證碼圖片
def getCodeImg():
    urlCode='http://csdn.juming.com/code.htm'
    image_bytes = urlopen(urlCode).read()
    # internal data file
    data_stream = io.BytesIO(image_bytes)
    # open as a PIL image object
    pil_image = Image.open(data_stream)
    tk_image = ImageTk.PhotoImage(pil_image)
    return tk_image
#構(gòu)建界面
def createGui(msg=''):
    global root
    root = tk.Tk()
    root.title("CSDN免積分下載器 v0.1")
    root.resizable(False, False)   #禁止修改窗口大小
    root.geometry('+400+250')  #屏幕位置
    #-------------------------------------------
    tk_image = getCodeImg()
    # put the image on a typical widget
    frm_top_label = tk.Label(root,compound = 'top',image=tk_image,text="驗證碼圖片",fg="blue",bg="brown",font=('Tempus Sans ITC',20))
    frm_top_label.grid(row = 0, column = 0, padx = 15, pady = 2)
    #-------------------------------------------
    frm_bottom = tk.LabelFrame(root)
    frm_bottom.grid(row = 1, column = 0, padx = 15, pady = 2)
    frm_bottom_label_0 = tk.Label(frm_bottom,text="下載地址:", font=('Tempus Sans ITC',15))
    frm_bottom_label_0.grid(row = 0, column = 0, padx = 5, pady = 2,sticky = "e") #控件右對齊
    frm_bottom_label_1 = tk.Label(frm_bottom,text="  驗證碼:", font=('Tempus Sans ITC',15))
    frm_bottom_label_1.grid(row = 1, column = 0, padx = 5, pady = 2,sticky = "e")
    frm_bottom_entry_var_0 = StringVar()
    frm_bottom_entry_0 = tk.Entry(frm_bottom,textvariable=frm_bottom_entry_var_0)
    frm_bottom_entry_0.grid(row = 0, column = 1, padx = 15, pady = 2)
    frm_bottom_entry_var_1 = StringVar()
    frm_bottom_entry_1 = tk.Entry(frm_bottom,textvariable=frm_bottom_entry_var_1) #設(shè)置密碼輸入框,熟悉show
    frm_bottom_entry_1.grid(row = 1, column = 1, padx = 15, pady = 2)
    frm_bottom_btn_0 = tk.Button(frm_bottom,text="下   載",relief=RIDGE,bd=4,width=10, font=('Tempus Sans ITC',12),command=lambda:downloadSource(frm_bottom_entry_var_0,frm_bottom_entry_var_1,frm_top_label,frm_foot_label))
    frm_bottom_btn_0.grid(row = 3, column = 1, padx = 15, pady = 2,sticky = "w")
    frm_foot_label = tk.Label(root,text=msg ,font=('Tempus Sans ITC',10))
    frm_foot_label.grid(row = 3, column = 0, padx = 15, pady = 2)
    root.mainloop() 
#獲取下載資源地址  
def getSourceUrl(code,ziyuandz):
    #資源信息 
    strLoginInfo = {'csdn_zh': '用戶名',
                    'csdn_mm': '密碼',
                    're_yzm':code,
                    'ziyuandz':ziyuandz #'http://download.csdn.net/detail/shinian1987/8430743' #
                    }
    #下載資源地址
    urlLogin='http://csdn.juming.com/index.htm'
    returnHtml = str(getUrlRequest(urlLogin,strLoginInfo))
    a = returnHtml.find('電信下載地址:<strong>') + 15
    b = returnHtml.find('</strong><br>網(wǎng)通下載地址:')
    durl = returnHtml[a:b]
    return durl
#下載資源
def downloadSource(frm_bottom_entry_var_0,frm_bottom_entry_var_1,frm_top_label,frm_foot_label):
    try:
        ziyuandz = frm_bottom_entry_var_0.get()
        code = frm_bottom_entry_var_1.get()
        durl = getSourceUrl(code,ziyuandz)
        print('資源地址:'+ durl)
        reMsg = "已經(jīng)打開瀏覽器,請下載..."
        yzm = durl.find("驗證碼")
        #yzm += durl.find("驗證碼驗證錯誤")
        #yzm += durl.find("驗證碼輸入不正確")
        fs = durl.find("封殺本工具特意加")
        gs = durl.find("正確的格式如")
        jf = durl.find("成功獲取到0點積分")
        xzzy = durl.find("http:")
        if fs > 0:
            reMsg = "該資源被封殺,請稍后再下載..."
        elif code=='':
            reMsg = "驗證碼不能為空..."
        elif ziyuandz=='':
            reMsg = "下載地址不能為空..."
        elif gs > 0:
            reMsg = "資源地址錯誤,請重新輸入..."
        elif yzm > 0:
            reMsg = "驗證碼輸入錯誤..."
        elif jf > 0:
            reMsg = "積分不足,資源無法下載..."
        elif xzzy >= 0: 
            webbrowser.open(durl, new=0, autoraise=True)
        else:
            reMsg = "資源錯誤或沒有找到下載資源..."
        #print(xzzy)
        frm_foot_label['text'] = reMsg
        tk_image = getCodeImg()
        frm_top_label.configure(image = tk_image)
        frm_top_label.image= tk_image
    except:
        root.destroy()
        createGui('程序錯誤,請重新下載...')
#MAIN
createGui()

演示圖片

 

以上就是本文的全部內(nèi)容了,希望大家能夠喜歡。

相關(guān)文章

  • pycharm 多行批量縮進和反向縮進快捷鍵介紹

    pycharm 多行批量縮進和反向縮進快捷鍵介紹

    這篇文章主要介紹了pycharm 多行批量縮進和反向縮進快捷鍵介紹,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-01-01
  • ubuntu上安裝python的實例方法

    ubuntu上安裝python的實例方法

    在本篇文章里小編給大家整理的是關(guān)于怎么在ubuntu安裝python的相關(guān)方法,以后需要的朋友們可以學習下。
    2019-09-09
  • 使用python庫xlsxwriter庫來輸出各種xlsx文件的示例

    使用python庫xlsxwriter庫來輸出各種xlsx文件的示例

    這篇文章主要介紹了使用python庫xlsxwriter庫來輸出各種xlsx文件的示例,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-09-09
  • 跟老齊學Python之啰嗦的除法

    跟老齊學Python之啰嗦的除法

    python 除法運算 比較奇怪,和別的程序語言不大一樣。從Python2.2開始,除法運算符除了/之外,又引入了一個除法運算符://,后一種運算符只用于進行整除法。對于除法運算符/,默認時的行為跟Python2.2之前的一樣,它視操作數(shù)而定,既可以進行整除,也可以進行真除法。
    2014-09-09
  • 解決Python3.7.0 SSL低版本導致Pip無法使用問題

    解決Python3.7.0 SSL低版本導致Pip無法使用問題

    這篇文章主要介紹了解決Python3.7.0 SSL低版本導致Pip無法使用問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09
  • 不要用強制方法殺掉python線程

    不要用強制方法殺掉python線程

    本文給大家分享的是走著的一些強制殺掉python線程經(jīng)驗教訓,如果你使用強制手段干掉線程,那么很大幾率出現(xiàn)意想不到的bug。 請記住一點,鎖資源不會因為線程退出而釋放鎖資源 !
    2017-02-02
  • Python數(shù)據(jù)可視化之Seaborn的使用詳解

    Python數(shù)據(jù)可視化之Seaborn的使用詳解

    Seaborn庫是python中基于matplotlib庫的可視化工具庫,通過sns我們可以更方便地繪制出更美觀的圖表。本文將分享python基于Seaborn庫的一系列繪圖操作,感興趣的可以了解一下
    2022-04-04
  • Python中的len()函數(shù)是什么意思

    Python中的len()函數(shù)是什么意思

    這篇文章主要介紹了Python中的len()函數(shù)是什么意思以及l(fā)en()函數(shù)使用,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-01-01
  • python3實現(xiàn)UDP協(xié)議的服務(wù)器和客戶端

    python3實現(xiàn)UDP協(xié)議的服務(wù)器和客戶端

    這篇文章主要為大家詳細介紹了python3實現(xiàn)UDP協(xié)議的服務(wù)器和客戶端,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • python 類的基礎(chǔ)詳解與應用

    python 類的基礎(chǔ)詳解與應用

    類用于指定對象的形式,它包含了數(shù)據(jù)表示法和用于處理數(shù)據(jù)的方法。類中的數(shù)據(jù)和方法稱為類的成員。函數(shù)在一個類中被稱為類的成員
    2021-11-11

最新評論