-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathebs_v4.py
51 lines (40 loc) · 1.66 KB
/
ebs_v4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import requests,wget,re
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import telegram
import asyncio
import warnings
from urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
warnings.filterwarnings('ignore', 'Unverified HTTPS request')
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
params = {
'returnUrl': 'https://5dang.ebs.co.kr',
'login_uri': 'https://5dang.ebs.co.kr/sso/login',
'i': '##ID##',
'c': '##PWD##'
}
header = {
'Referer':'https://5dang.ebs.co.kr/login',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
}
token = '##TOKEN##'
chat_id = '##ID##'
bot = telegram.Bot(token=token)
login_url = 'https://5dang.ebs.co.kr/login'
url_list = [
'https://5dang.ebs.co.kr/auschool/sub/replay?prodId=235&lectId=60359619&pageNum=8&orderby=NEW&situ=&startDate=&endDate=&pdfOnly=',
]
#rec_url = 'https://5dang.ebs.co.kr/auschool/sub/replay?prodId=235&lectId=60344311&pageNum=9&orderby=NEW&situ=&startDate=&endDate=&pdfOnly='
filename = ''
with requests.Session() as s:
for url in url_list:
res = s.post(login_url,headers=header,data=params,verify=False)
res = s.get(url,headers=header,verify=False)
url = "https://wstrotu.ebs.co.kr" + re.split('wstrotu.ebs.co.kr',res.text,re.S)[1]+ "wstrotu.ebs.co.kr"
wget.download(url)
filename = url.split('?')[0].split('/')[-1]
async def main():
await bot.send_audio(chat_id=chat_id, audio=open(filename,'rb'))
asyncio.run(main())
# if __name__ == '__main__':
# print_hi('PyCharm')±±