python3 實現(xiàn)的人人影視網(wǎng)站自動簽到
這是一個自動化程度較高的程序,運行本程序后會從chrome中讀取cookies用于登錄人人影視簽到,
并且會自動添加一個windows 任務(wù)計劃,這個任務(wù)計劃每天下午兩點會執(zhí)行本程序進行簽到。
sys.executable == 'C:\\Python34\\pythonw.exe'
使用pythonw 執(zhí)行.py 不會彈出命令行窗口。
以system權(quán)限執(zhí)行的程序不能訪問網(wǎng)絡(luò),/ru 參數(shù)后的值改為administrators或者users
import os import sys import subprocess import sqlite3 import time import requests from win32.win32crypt import CryptUnprotectData def getcookiefromchrome(host='.oschina.net'): cookiepath=os.environ['LOCALAPPDATA']+r"\Google\Chrome\User Data\Default\Cookies" sql = "select host_key,name,encrypted_value from cookies where host_key='%s'" % host with sqlite3.connect(cookiepath) as conn: cu = conn.cursor() cookies = {name:CryptUnprotectData(encrypted_value)[1].decode() for host_key,name,encrypted_value in cu.execute(sql).fetchall()} print(cookies) return cookies #運行環(huán)境windows 2012 server python3.4 x64 pywin32 chrome 50 """ #windows 版chrome Cookies文件為一個sqlite3數(shù)據(jù)庫, #chrome 33以后的版本的cookies的value都加密存在encrypted_value中, #需要使用win32crypt的CryptUnprotectData 對encrypted_value進行解密, win32crypt是pywin32的一部分,需要安裝最新的pywin32模塊 """ #getcookiefromchrome() #getcookiefromchrome('.baidu.com') def sign(): zmcookie = getcookiefromchrome('.zimuzu.tv') url = 'http://www.zimuzu.tv/user/login/getCurUserTopInfo' requests.get(url,cookies=zmcookie).text rs = requests.get('http://www.zimuzu.tv/user/sign',cookies=zmcookie).text.split('\n') info = [r for r in rs if "三次登錄時間" in r] time_=time.strftime("%c") with open("zmlog.txt","a+") as f: f.write(time_ + " :" ) f.writelines(info) f.write("\n\n") tn='zmautosign' def run(ar=sys.argv): if len(ar)==1: sign() if not intask(): addtask() #添加任務(wù)計劃 elif len(ar)>1 and ar[1].lower()=="-task": sign() def intask(tn=tn,ar=sys.argv[0]): txt=subprocess.getoutput('schtasks /query |find "%s"' % tn) if tn in txt: return 1 else: return 0 def addtask(tn=tn,ar=sys.argv[0]): cmd='schtasks /create /F /ru Administrators /tn "%s" /sc daily /st 14:00:00 /tr "%s %s -task"' % (tn,sys.executable,ar) subprocess.call(cmd,shell=1) os.chdir(sys.path[0]) run()
- python實現(xiàn)的爬取電影下載鏈接功能示例
- Python3.6實現(xiàn)根據(jù)電影名稱(支持電視劇名稱),獲取下載鏈接的方法
- Python爬取APP下載鏈接的實現(xiàn)方法
- Python3使用requests登錄人人影視網(wǎng)站的方法
- python b站視頻下載的五種版本
- Python爬蟲之批量下載喜馬拉雅音頻
- 教你用Python下載抖音無水印視頻
- Python Django搭建文件下載服務(wù)器的實現(xiàn)
- 教你如何使用Python下載B站視頻的詳細教程
- python基于tkinter制作m3u8視頻下載工具
- 用python制作個論文下載器(圖形化界面)
- 用Python自動下載網(wǎng)站所有文件
- python 爬取影視網(wǎng)站下載鏈接
相關(guān)文章
PyMongo 查詢數(shù)據(jù)的實現(xiàn)
本文主要介紹了PyMongo 查詢數(shù)據(jù),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2021-06-06pandas實現(xiàn)按照多列排序-ascending
這篇文章主要介紹了pandas實現(xiàn)按照多列排序-ascending,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-05-05python如何實現(xiàn)wifi自動連接,解決電腦wifi經(jīng)常斷開問題
這篇文章主要介紹了python實現(xiàn)wifi自動連接,解決電腦wifi經(jīng)常斷開的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-06-06如何利用pyinstaller打包Python程序為exe可執(zhí)行文件
這篇文章主要給大家介紹了關(guān)于如何利用pyinstaller打包Python程序為exe可執(zhí)行文件的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2021-04-04