-
Notifications
You must be signed in to change notification settings - Fork 0
/
yyets.py
32 lines (29 loc) · 877 Bytes
/
yyets.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
#/usr/bin/env python
# -*- coding=utf-8 -*-
import urllib
import urllib2
import re
import os
def post(url, data, key):
req = urllib2.Request(url)
data = urllib.urlencode(data)
#enable cookie
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
response = opener.open(req, data)
# visit Game of Thrones webpage with cookie
yyets = opener.open('http://www.yyets.com/resource/a10733')
respHtml = yyets.read()
find = re.search(key, respHtml)
if find:
os.system('echo "Winter is coming"|mutt @')
def main():
posturl = "http://www.yyets.com/User/Login/ajaxLogin"
data = {'account':'nickname',
'password':'pwd',
'from':'loginpage',
'remember':'0',
'url_back':''}
key = "S04E03.中英字幕"
post(posturl, data, key)
if __name__ == '__main__':
main()