From 3cb3127e13eb7a8fc86065d2a36091744abee0d8 Mon Sep 17 00:00:00 2001 From: Aike <60257865+Crtd-Code@users.noreply.github.com> Date: Fri, 5 Feb 2021 20:17:22 +0800 Subject: [PATCH] Update loveword.py --- loveword.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loveword.py b/loveword.py index 000b76f..b2fe073 100644 --- a/loveword.py +++ b/loveword.py @@ -1,7 +1,11 @@ +#!/usr/bin/python3 +#coding=utf-8 + import requests from bs4 import BeautifulSoup import random import os +import time SKEY=os.environ.get('SKEY') #CoolPush酷推KEY def getlovewords(): headers={ @@ -10,6 +14,7 @@ def getlovewords(): # 获取情话 texts=[] for page in range(1,20): + time.sleep(3) url = 'https://www.duanwenxue.com/huayu/tianyanmiyu/list_{}.html'.format(page) response = requests.get(url,headers=headers) soup=BeautifulSoup(response.text,'lxml')