
正文
Python-demo(抖音)
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
# -*- coding:utf-8 -*- from mitmproxy import ctx
import json
import requests
import time
import os
path = "抖音视频/"
initUrl = ["http://v1-dy.bytecdn.cn","http://v2-dy.bytecdn.cn","http://v3-dy.bytecdn.cn","http://v4-dy.bytecdn.cn","http://v5-dy.bytecdn.cn","http://v6-dy.bytecdn.cn"] num = 0
def response(flow):
global num
for url in initUrl:
# 过滤掉不需要的url
if flow.request.url.startswith(url):
print(flow.request.url)
# 设置视频名
filename = path + str(num) + '.mp4'
print(filename)
# 使用request获取视频url的内容
# stream=True作用是推迟下载响应体直到访问Response.content属性 res = requests.get(flow.request.url, stream=True)
# 将视频写入文件夹
with open(filename, 'ab') as f:
f.write(res.content)
f.flush()
print(filename + '下载完成')
num += 1
# _*_ coding:utf-8 _*_ import os #from PIL import Image import subprocess import time __author__ = 'admin' # order='adb devices' #获取连接设备
# pi= subprocess.Popen(order,shell=True,stdout=subprocess.PIPE)
# print(pi.stdout.read())#打印结果
def mobile_in(code):
# 开启电源键
# os.popen('adb shell input keyevent 26')
time.sleep(1)
# 滑动屏幕进入输入密码界面
os.popen('adb shell input swipe 539 1868 539 1600')
time.sleep(1)
for i in range(len(code)):
if code[i] == '':
# 密码盘上的“0”
os.popen('adb shell input swipe 480 1440 600 1550')
time.sleep(1)
elif code[i] == '':
# 密码盘上的“1”
os.popen('adb shell input swipe 200 740 320 860')
time.sleep(1)
elif code[i] == '':
# 密码盘上的“2”
os.popen('adb shell input swipe 480 740 600 860')
elif code[i] == '':
# 密码盘上的“3”
os.popen('adb shell input swipe 760 740 880 860')
elif code[i] == '':
# 密码盘上的“4”
os.popen('adb shell input swipe 200 990 320 1110')
elif code[i] == '':
# 密码盘上的“5”
os.popen('adb shell input swipe 480 990 600 1110')
elif code[i] == '':
# 密码盘上的“6”
os.popen('adb shell input swipe 760 990 880 1110')
elif code[i] == '':
# 密码盘上的“7”
os.popen('adb shell input swipe 200 1240 320 1360')
elif code[i] == '':
# 密码盘上的“8”
os.popen('adb shell input swipe 480 1240 600 1360')
elif code[i] == '':
# 密码盘上的“9”
os.popen('adb shell input swipe 760 1240 880 1360')
time.sleep(1) code = list('')
#手机解锁
#mobile_in(code) # startapp = "adb shell am start -n com.ss.android.ugc.aweme/.main.MainActivity" def loop(times):
for i in range(times):
os.popen('adb shell input swipe 539 800 539 400')
time.sleep(2) if __name__ == "__main__":
# os.popen(startapp)
time.sleep(5)
loop(30)







