#!/usr/bin/python_# -- coding: UTF-8 --_import requests,json,re
from bs4 import BeautifulSoup as BeautifulSoup
dingtalk_url = “https://oapi.dingtalk.com/robot/send?access_token=856406880ce7735633eebc761d00eabb11fa0ca47cba8de800c74512bc11fdf2"response = requests.get(“http://www.eleefeed.com/“)
soup = BeautifulSoup(response.text,’html.parser’)
div = soup.find_all(‘div’,{‘class’:’title’},{‘a’:{‘target’:’_blank’}})
def send_message(Dingtalk_url, title, message):
data = {
‘msgtype’: ‘markdown’,
‘markdown’: {
‘title’: ‘%s\n\n’ % title,
‘text’: “### %s\n\n %s” % (title, message)
},
‘at’: {
‘atMobiles’: [],
‘isAtAll’: False }
}
response = requests.post(
Dingtalk_url,
json=data,
verify=True)
print(response.content)
return response
msg = “\n\n”count = 0btns = []
for i in div:
if re.match(“^http”, i.find(‘a’)[“href”]):
continue msg += “> ● %s\n\n\n” % (i.string, “http://www.eleefeed.com“ + i.find(‘a’)[“href”])
count += 1 if count == 5:
breakprint(msg)
send_message(dingtalk_url,”EleeFeed”,msg)