Skip to content

Commit

Permalink
fix: Update referer and user-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
chettoy committed Sep 21, 2022
1 parent ff937b9 commit 076075c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions fxxkstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
G_HEADERS = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0",
"Connection": "keep-alive",
"Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
}
Expand Down Expand Up @@ -1436,7 +1436,7 @@ def _request_status(fxxkstar: FxxkStar, object_id: str) -> dict:
status_url = "https://mooc1.chaoxing.com/ananas/status/{}?flag=normal&_dc={}".format(
object_id, int(time.time() * 1000))
status_rsp = fxxkstar.request_xhr(status_url, {
"Referer": "https://mooc1.chaoxing.com/ananas/modules/pdf/index.html?v=2022-0218-1135"
"Referer": "https://mooc1.chaoxing.com/ananas/modules/pdf/index.html?v=2022-0830-1135"
}, method="GET")
status_json = json.loads(status_rsp.text)
if status_json['status'] == 'success':
Expand All @@ -1450,7 +1450,7 @@ def _misson_doucument(fxxkstar: FxxkStar, course_id, clazz_id, chapter_id, jobid
url = "https://mooc1.chaoxing.com/ananas/job/document?jobid={}&knowledgeid={}&courseid={}&clazzid={}&jtoken={}".format(
jobid, chapter_id, course_id, clazz_id, jtoken)
multimedia_rsp = fxxkstar.request_xhr(url, {
"Referer": "https://mooc1.chaoxing.com/ananas/modules/pdf/index.html?v=2022-0218-1135"
"Referer": "https://mooc1.chaoxing.com/ananas/modules/pdf/index.html?v=2022-0830-1135"
}, method="GET")
print("[INFO] mission_document")
print(multimedia_rsp.text)
Expand Down Expand Up @@ -1480,7 +1480,7 @@ def _request_status(fxxkstar: FxxkStar, object_id: str) -> dict:
status_url = "https://mooc1.chaoxing.com/ananas/status/{}?k=1606&flag=normal&_dc={}".format(
object_id, int(time.time() * 1000))
status_rsp = fxxkstar.request_xhr(status_url, {
"Referer": "https://mooc1.chaoxing.com/ananas/modules/video/index.html?v=2022-0406-1945"
"Referer": "https://mooc1.chaoxing.com/ananas/modules/video/index.html?v=2022-0909-2029"
}, method="GET")
status_json = json.loads(status_rsp.text)
if status_json['status'] == "success":
Expand Down Expand Up @@ -1532,6 +1532,7 @@ def encode_enc(clazzid: str, duration: int, objectId: str, otherinfo: str, jobid

class WorkModule(AttachmentModule):
# module/work/index.html?v=2021-0927-1700
# referer updated: 2022-0714-1515

cx_uncovering = None

Expand Down Expand Up @@ -1617,7 +1618,7 @@ def _load(self):
print("[INFO] module_work, src=" + src)

headers = self.fxxkstar.get_agent().build_headers_based_on(self.fxxkstar.get_agent().headers_additional_iframe, {
"Referer": "https://mooc1.chaoxing.com/ananas/modules/work/index.html?v=2021-0927-1700&castscreen=0"
"Referer": "https://mooc1.chaoxing.com/ananas/modules/work/index.html?v=2022-0714-1515&castscreen=0"
})
src2 = self.fxxkstar.url_302(src, headers)
src3 = self.fxxkstar.url_302(src2, headers)
Expand Down Expand Up @@ -2294,7 +2295,7 @@ def _validate(fxxkstar: FxxkStar, course_id: str, clazz_id: str, cpi: str) -> bo
course_id, clazz_id, cpi)
rsp_text = fxxkstar.request_xhr(ajax_url, {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Referer": "https://mooc1.chaoxing.com/ananas/modules/work/index.html?v=2021-0927-1700&castscreen=0",
"Referer": "https://mooc1.chaoxing.com/ananas/modules/work/index.html?v=2022-0714-1515&castscreen=0",
}).text
# {"status":3}
if G_VERBOSE:
Expand Down Expand Up @@ -2354,7 +2355,7 @@ def module_work_submit(fxxkstar: FxxkStar, work_page_html: str, do_submit=False)

rsp_text = fxxkstar.request_xhr(ajax_url, {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Referer": "https://mooc1.chaoxing.com/ananas/modules/work/index.html?v=2021-0927-1700&castscreen=0",
"Referer": "https://mooc1.chaoxing.com/ananas/modules/work/index.html?v=2022-0714-1515&castscreen=0",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}, data=ajax_data, method=ajax_type).text
# {"msg":"保存成功!","status":true}
Expand Down Expand Up @@ -2533,7 +2534,7 @@ def __init__(self, video_mod: VideoModule):
video_mod.fxxkstar.get_agent().headers_additional_xhr, {
'Accept': '*/*',
'Content-Type': 'application/json',
'Referer': 'https://mooc1.chaoxing.com/ananas/modules/video/index.html?v=2022-0406-1945',
'Referer': 'https://mooc1.chaoxing.com/ananas/modules/video/index.html?v=2022-0909-2029',
})
self.clazz_id: str = video_mod.clazz_id
self.duration: int = video_mod.get_duration()
Expand Down

0 comments on commit 076075c

Please sign in to comment.