宋词三百首最后一首诗词信息查询

本页面提供宋词三百首中每卷最后一首诗词的卷、词牌名、首句和作者信息,方便用户快速查找和了解宋词内容。

查询结果:

第1首 卷一·唐五代词 词牌名'南乡子' 首句'乘彩舫' 作者李珣

第2首 卷二·唐五代词 词牌名'望江南' 首句'天上月' 作者佚名

第3首 卷三·北宋词 词牌名'贺圣朝' 首句'留别' 作者叶清臣

第4首 卷四·北宋词 词牌名'浣溪沙' 首句'簌簌衣巾落枣花' 作者苏轼

第5首 卷五·北宋词 词牌名'临江仙' 首句'未遇行藏谁肯信' 作者侯蒙

代码示例:

import requests
from bs4 import BeautifulSoup

url = "https://so.gushiwen.org/gushi/songsan.aspx"

response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")

volume_elements = soup.find_all("div", class_="typecont")
count = 1

for volume_element in volume_elements:
    volume_name = volume_element.find("div", class_="bookMl").text.strip()
    ci_elements = volume_element.find_all("div", class_="sons")
    for ci_element in ci_elements:
        ci_title = ci_element.find("p", class_="cont").text.strip()
        author = ci_element.find("p", class_="source").text.strip().split(":")[1]
        first_sentence = ci_element.find("div", class_="contson").text.strip().split("。")[0]
        if not first_sentence:
            first_sentence = "无"
        print(f"第{count}首 {volume_name} {ci_title} 首句{first_sentence} 作者{author}")
        count += 1

注意:

  • 此代码仅供参考,实际网页结构可能会有所不同,需要根据实际情况进行调整。
  • 本页面仅提供信息查询服务,不提供任何网络爬虫服务。

原文地址: https://www.cveoy.top/t/topic/o5no 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录