|
@@ -86,8 +86,11 @@ def comment_page(driver, urls, comment):
|
|
|
|
|
|
def random_comment():
|
|
|
# You can edit these lines=======
|
|
|
- df = pd.read_excel('/Users/zooeytsai/Downloads/yt留言.xlsx')
|
|
|
- messages = df['文字']
|
|
|
+ # df = pd.read_excel('/Users/zooeytsai/Downloads/yt留言.xlsx')
|
|
|
+ # messages = df['文字']
|
|
|
+ r = redis.Redis(host='db.ptt.cx', port=6379, db=0, password='choozmo9')
|
|
|
+ js = r.get('yt_comment')
|
|
|
+ messages = json.loads(js)
|
|
|
# ===============================
|
|
|
r = np.random.randint(0, len(messages))
|
|
|
print(messages[r])
|