微博展开全文获取

mac2022-06-30  21

pc端

def getlongtext(self,mid:str,req:requests)->"获取全文逻辑": allinfo=None getlongtexturl=f"http://s.weibo.com/ajax/direct/morethan140?mid={mid}" resp=req.get(getlongtexturl,timeout=60).json() okcode=resp["code"] if okcode=="100000": allinfo=resp["data"]["html"] else: print("get log text is error,here are detail:{}",traceback.format_exc()) return allinfo

h5端

def getlongtext(self,mid:str,req:requests)->"获取全文逻辑": allinfo=None getlongtexturl=f"https://m.weibo.cn/statuses/extend?id={mid}" resp=req.get(getlongtexturl,timeout=60).json() okcode=resp["ok"] if okcode==1: allinfo=resp["data"]["longTextContent"] else: print("get log text is error,here are detail:{}",traceback.format_exc()) return allinfo

转载于:https://www.cnblogs.com/c-x-a/p/9341992.html

相关资源:python新浪微博爬虫,爬取微博和用户信息 (含源码及示例)
最新回复(0)