Skip to content

Commit cabcd18

Browse files
author
ramnode
committed
fix: ignore the empty xml node
1 parent b6f4c06 commit cabcd18

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fanfou.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def directmsg():
1818
for i in range(num):
1919
id = xml[i][0].text
2020
msg = xml[i][1].text
21+
if not msg:
22+
continue
2123
logbook.info(msg.encode("utf8"))
2224
sendtext(msg.encode("utf8"))
2325
code = api.post('direct_messages/destroy', id=id)
@@ -29,9 +31,11 @@ def sendtext(content):
2931
xml = api.get('account/rate_limit_status')
3032
xml = etree.fromstring(xml)
3133
limit_num = xml[1].text
34+
logbook.info(limit_num)
3235
if int(limit_num) == 0:
3336
return
3437
code = api.post('statuses/update',status=content)
38+
logbook.info(content)
3539
logbook.info("sent!")
3640

3741
if __name__ == '__main__':
@@ -48,4 +52,4 @@ def sendtext(content):
4852

4953
while True:
5054
directmsg()
51-
time.sleep(60)
55+
time.sleep(10)

0 commit comments

Comments
 (0)