Crawling embarrassments Encyclopedia, micro-channel automatic transmission
# https://www.qiushibaike.com/text/ # https://www.qiushibaike.com/text/page/1/ import requests from bs4 import BeautifulSoup ret=requests.get('https://www.qiushibaike.com/text/page/1/') # print(ret.text) ll=[] soup=BeautifulSoup(ret.text,"lxml") article_list=soup.find_all(name='div',id=True,class_='article') for article in article_list: Content = article.find (name = ' div ' , the class_ = ' Content ' ) .span.text # Content = article.find (name = 'div', _ = class 'Content'). text # Content = article.find ( _ = class 'Content'). text # Print (Content) # storage # we put the list ll.append (Content) # Print (LL) # Micro-channel automatic message # wxpy: micro-channel achieved a web interface # PIP3 the install wxpy from wxpy Import * # instantiate an object obtained, micro-channel robot object Import Random bot=Bot(cache_path=True) # Friend bot.search = ( 'ultra Yuan') [0] # Print (Friend) @ bot.register () # A receives a message from the specified friends, i.e. the sender specified recv_msg.sender friend girl_friend DEF recv_send_msg (recv_msg ): Print ( ' message received: ' , recv_msg.text) # recv_msg.text get text # IF recv_msg.sender == Friend: # return random.choice (LL) return ' you're beautiful ' embed ()