发布于2020-04-09 19:14 阅读(8833) 评论(5) 点赞(22) 收藏(3)
网站长这个样子
网址:https://www.ixueto.com/login.aspx
完整代码如下
import requests
import json
from lxml import etree
import re
import time
data = {'action': 'ztlesslist',
'jgid': '117',
'ztid': '891',
'page': '1',
'rows': '180'}
text = requests.post('https://www.ixueto.com/ashxV3/jigou.ashx',data=data).content.decode('utf-8')
print(text)
text = json.loads(text)
text = text['content']
tree = etree.HTML(text)
html = tree.xpath('//div[@class="fl-l wid100 kechengmark"]/a/@href')
htm2 = tree.xpath('//div[@class="fl-l wid100 kechengmark"]/a/div/section/text()')
lists = {}
for i in range(len(htm2)):
a = re.compile(r'\?id=(\d+)')
allid = a.findall(html[i])
hour = htm2[i][2:4]
minute = htm2[i][5:7]
second = htm2[i][8:10]
alltimes = int(hour) *60*60 + int(minute)*60 + int(second)
lists[allid[0]] = alltimes
################################################################
STUUID = '' #填写用户id
IMAGE_BS64_JPEG = ''#填写jpeg格式的照片经过bs64后的数据
URL = '' #填写网址
################################################################
num =0
for i in lists:
num= num+1
LESSID = i #视频id
TIME = lists[i] #观看时间
#1
headers = {
'Referer': 'https://www.ixueto.com/v3/space/jigou_zhuantidetail.aspx?'
}
html = requests.get('https://www.ixueto.com/course_study.aspx?id={}{}'.format(LESSID,URL),headers=headers)
print(html)
#2
headers = {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '56',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36',
}
data = {'action': 'getCourseTime',
'lessid': '{}'.format(LESSID), #视频id
'stuuid': '{}'.format(STUUID),
'ztid': '891'}
a = requests.post(url='https://www.ixueto.com/ashx/course.ashx',headers=headers,data=data)
print(a.text)
#3
headers = {'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '45726',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Host': 'www.ixueto.com',
'Origin': 'https://www.ixueto.com',
'Referer': 'https://www.ixueto.com/course_study.aspx?id=12458&luid=U5Ny6uoimrQ=&ztid=891&jgid=117&v=1585471941275',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36',
'X-Requested-With':'XMLHttpRequest'}
data ={
'action': 'ComparePhotoInfo',
'userId': '{}'.format(STUUID),#用户id
'src': '{}'.format(IMAGE_BS64_JPEG),
'cid': '{}'.format(LESSID),#视频id
'jgpid': '88056',
'isSave': 'false'
}
sa = requests.post(url='https://www.ixueto.com/web/NewAshx/Personal.ashx',headers=headers,data=data)
print(sa.text)
#4
headers = {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '56',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36',
}
data = {'action': 'updatetimes',
'lessid': '{}'.format(LESSID), #视频id
'xxtimes': '{}'.format(TIME), #观看时间
'stuuid': '{}'.format(STUUID),
'phone': '1',
'ztid': '891'}
a = requests.post(url='https://www.ixueto.com/ashx/course.ashx',headers=headers,data=data)
print('这是第{}个,还剩{}个'.format(num,int(len(lists))-num)+a.text)
STUUID:
f12打开开发者工具,然后如图所示找到stuuid
IMAGE_BS64_JPEG:
拍一张照片然后把后缀改成.jpeg
进入这个网站:http://tool.chinaz.com/tools/imgtobase/
把图片转换成base64数据
URL:
进入观看视频页面后复制红圈表示的内容
运行效果如下
截至4月7号,本代码无任何问题
原文链接:https://blog.csdn.net/qq_44749634/article/details/105363237
作者:iuie9493
链接:https://www.pythonheidong.com/blog/article/319547/a0b737e5ad30ac764a2a/
来源:python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
现在用不了了
显示用户名失效 我把图片转成的base64数据放在txt文件中,然后在python中通过open()打开, 显示存在不安全字符
为什么显示用户名失效呢?
为什么提示用户名失效呢?
显示用户名失效 我把图片转成的base64数据放在txt文件中,然后在python中通过open()打开, 显示存在不安全字符
我也是用户名失效,请问您解决了吗?
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!