-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrawl.py
54 lines (51 loc) · 1.32 KB
/
crawl.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
52
53
54
import getpass, imaplib
M = imaplib.IMAP4_SSL('dikrong.iitg.ernet.in')
M.login('vivekraj', 'ZQMVzYzT')
M.select()
typ, data = M.search(None, 'ALL')
flag=0
flag1=0
str=""
a=1
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
print("\nMessage ", a)
# <<<<<<< HEAD
# # for word in data[0][1].split():
# word=data[0][1]
# x=word.decode('cp1252')
# # if "Importance" in x:
# # flag=1
# # print("xyz")
# # elif flag==1:
# # if "Content-Type" in word.decode('cp1252'):
# # # if not "Content-Type: text/plain" in word.decode('cp1252'):
# # break
# # else :
# # str = str + " " + word.decode('cp1252')
# z=x.split("Content-Type:",1)
# for y in z:
# if not (len(y)>20000):
# print(y)
# # print x.split("Content-Type: text/plain",1)[0]
# a=a+1
# # print(str)
# =======
# for word in data[0][1].split():
# x=word.decode('cp1252')
# if "Importance" in x:
# flag=1
# elif flag==1:
# if "Content-Type" in word.decode('cp1252'):
# break
# else :
# str = str + " " + word.decode('cp1252')
# a=a+1
# print(str)
# >>>>>>> 79c27eb32331afa691b61eea82ad1e188c72b5ba
str=""
flag=0
flag1=0
# print ('Message : %s\n%s\n' % (num, data[0][1]))
M.close()
M.logout()