import requests
import re
headers = {
'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36'
}
content = requests. get( 'https://book.douban.com/' , headers= headers)
pattern = re. compile ( '<li.*?cover.*?href="(.*?)" title="(.*?)".*?more-meta.*?author">(.*?)</span>.*?year">(.*?)</span>.*?</li>' , re. S)
result = re. findall( pattern, content. text)
for i in result:
url, title, author, date = i
print ( url. strip( ) , title. strip( ) , author. strip( ) , date. strip( ) )
out:
https: // book. douban. com/ subject/ 34937417 / ?icn= index- latestbook- subject 午后四点 [ 比利时] 阿梅丽·诺冬 2020 - 4
https: // book. douban. com/ subject/ 27197932 / ?icn= index- latestbook- subject 拜占庭的新生 [ 英] 约翰·朱利叶斯·诺里奇 2020 - 4
https: // book. douban. com/ subject/ 34826184 / ?icn= index- latestbook- subject 大小谎言 [ 澳大利亚] 莉安·莫里亚蒂 2020 - 4
https: // book. douban. com/ subject/ 34949679 / ?icn= index- latestbook- subject 小津安二郎剧本集 [ 日] 小津安二郎 2020 - 4
https: // book. douban. com/ subject/ 34914941 / ?icn= index- latestbook- subject 火中遗物 [ 阿根廷] 玛丽安娜•恩里克斯(Mariana Enriquez) 2020 - 4 - 1
https: // book. douban. com/ subject/ 34994064 / ?icn= index- latestbook- subject 这辈子 高彩云(口述 )& nbsp; / & nbsp; 赵丽君(笔录)& nbsp; / & nbsp; 杨扬(整理) 2020 - 4
https: // book. douban. com/ subject/ 34893668 / ?icn= index- latestbook- subject 暗数杀人笔记 虫安 2020 - 2
https: // book. douban. com/ subject/ 34909430 / ?icn= index- latestbook- subject 你好,艺术!(全13 册) ( 日) 结城昌子 2020 - 4
https: // book. douban. com/ subject/ 34947567 / ?icn= index- latestbook- subject 私恋失调 倪闻天 2020 - 4
https: // book. douban. com/ subject/ 34896921 / ?icn= index- latestbook- subject 父权制与资本主义 [ 日] 上野千鹤子 2020 - 3
https: // book. douban. com/ subject/ 34835367 / ?icn= index- latestbook- subject 四象 梁鸿 2020 - 3
https: // book. douban. com/ subject/ 33406383 / ?icn= index- latestbook- subject 民歌40 陶晓清 | 统筹& nbsp; / & nbsp; 杨嘉 | 主编 2020 - 5
https: // book. douban. com/ subject/ 34929521 / ?icn= index- latestbook- subject 刺客列传 郑问 2020 - 5
https: // book. douban. com/ subject/ 35006892 / ?icn= index- latestbook- subject 程序员修炼之道(第2 版) Andrew Hunt& nbsp; / & nbsp; David Thomas 2020 - 4 - 1
https: // book. douban. com/ subject/ 34942796 / ?icn= index- latestbook- subject 异国绮谈 [ 日] 谷崎润一郎 2020 - 3
https: // book. douban. com/ subject/ 34942344 / ?icn= index- latestbook- subject 逝物录 [ 德] 尤迪特·沙朗斯基 2020 - 4
https: // book. douban. com/ subject/ 34942379 / ?icn= index- latestbook- subject 移民 [ 德] 温弗里德·塞巴尔德 2020 - 3
https: // book. douban. com/ subject/ 34983259 / ?icn= index- latestbook- subject 妇科圣经 [ 美] 伊丽莎白·G. 斯图尔特& nbsp; / & nbsp; [ 美] 宝拉·斯宾塞 2020 - 3
https: // book. douban. com/ subject/ 34912805 / ?icn= index- latestbook- subject 七个疯子 [ 阿根廷] 罗伯特·阿尔特 2020 - 4
https: // book. douban. com/ subject/ 34992172 / ?icn= index- latestbook- subject 宋仁宗:共治时代 吴钩 2020 - 4
https: // book. douban. com/ subject/ 34978161 / ?icn= index- latestbook- subject 伊斯坦布尔之刃 [ 阿根廷] 豪尔赫·曾特纳 编& nbsp; / & nbsp; [ 西] 鲁本·佩耶赫罗 绘 2020 - 4
https: // book. douban. com/ subject/ 34989767 / ?icn= index- latestbook- subject 风险社会学 [ 德] 尼克拉斯·卢曼 2020 - 4
https: // book. douban. com/ subject/ 30282308 / ?icn= index- latestbook- subject 我的同时代人的故事 [ 俄] 符拉季米尔·加拉克齐昂诺维奇·柯罗连科 2020 - 3
https: // book. douban. com/ subject/ 34965163 / ?icn= index- latestbook- subject 有悬念的气味,以及不盲从的生活 颂元 2020 - 3
https: // book. douban. com/ subject/ 34996428 / ?icn= index- latestbook- subject 赤朽叶家的传说 [ 日] 樱庭一树 2020 - 5 - 1
https: // book. douban. com/ subject/ 34886843 / ?icn= index- latestbook- subject 大卫·林奇:他来自异世界 [ 美] 丹尼斯·林(Dennis Lim) 2020 - 2
https: // book. douban. com/ subject/ 34969939 / ?icn= index- latestbook- subject 鹌鹑 郭沛文 2020 - 4
https: // book. douban. com/ subject/ 34907824 / ?icn= index- latestbook- subject 第三帝国的兴亡 ( 美) 威廉·夏伊勒 ( William L. Shirer) 2020 - 3
https: // book. douban. com/ subject/ 34907964 / ?icn= index- latestbook- subject 小森林 [ 日] 五十岚大介 2020 - 3
https: // book. douban. com/ subject/ 34951591 / ?icn= index- latestbook- subject 唐人如何吟诗 【日】大岛正二 2020 - 4 - 1
https: // book. douban. com/ subject/ 34933700 / ?icn= index- latestbook- subject 莫比乌斯时空 顾适 2020 - 3
https: // book. douban. com/ subject/ 34908320 / ?icn= index- latestbook- subject 语言的诞生 [ 美] 丹尼尔·L. 埃弗雷特( Daniel L. Everett) 2020 - 4
https: // book. douban. com/ subject/ 34464665 / ?icn= index- latestbook- subject 写在身体上 [ 英] 珍妮特·温特森 2020 - 4
https: // book. douban. com/ subject/ 34908427 / ?icn= index- latestbook- subject 维京人的世界 [ 英] 菲利普·帕克& nbsp; / & nbsp; Philip Parker 2020 - 3
https: // book. douban. com/ subject/ 34995610 / ?icn= index- latestbook- subject 八百万种死法 [ 美] 劳伦斯·布洛克 2020 - 4 - 1
https: // book. douban. com/ subject/ 34937631 / ?icn= index- latestbook- subject 给一个未出生孩子的信 [ 意] 法拉奇 2020 - 3
https: // book. douban. com/ subject/ 34985247 / ?icn= index- latestbook- subject 女人的勋章 [ 日] 山崎丰子 2020 - 3 - 1
https: // book. douban. com/ subject/ 35019783 / ?icn= index- latestbook- subject 生存还是毁灭 [ 南非] 大卫·贝纳塔 2020 - 4
https: // book. douban. com/ subject/ 34969956 / ?icn= index- latestbook- subject 遗忘通论 [ 安哥拉] 若泽·爱德华多·阿瓜卢萨 José Eduardo Agualusa 2020 - 4
https: // book. douban. com/ subject/ 35005170 / ?icn= index- latestbook- subject 新政之后 [ 美] 司昆仑 2020 - 4