import requests
import re
headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'
}
R=requests.get('https://tieba.baidu.com/f?kw=%E5%AD%99%E7%AC%91%E5%B7%9D',headers=headers)
print(re.findall("""<a rel="noopener" href=".*?" title="(.*?)" target="_blank" class="j_th_tit ">.*?</a>""",R.content.decode(),re.DOTALL))
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'}
R=requests.get('https://36kr.com/',headers=headers)
url1=re.findall("""<a class="article-item-title weight-bold" href="(.*?)" target="_blank" sensors_operation_list="page_flow">.*?</a>""",R.text)
url2=['https://36kr.com'+i for i in url1]
print(url2)
title=re.findall("""<a class="article-item-title weight-bold" href=".*?" target="_blank" sensors_operation_list="page_flow">(.*?)</a>""",R.text)
print(title)