如何使用Scrapy从响应的<lyric>标签CDATA中提取链接?
Extracting the Lyric Link from Your XML Response
Got it, let's pull that lyric link out for you right away.
Looking at the XML snippet you shared, the lyric URL is nested inside the <lyric> tag's CDATA section. Here's the exact link we extracted:
https://lrc-nct.nixcdn.com/2018/02/21/f/b/1/1/1519207822262.lrc
Quick steps to replicate this extraction:
- First, locate the
<lyric>opening and closing tags in your XML response. - Inside these tags, the content is wrapped in
<![CDATA[...]]>— this is a special section that keeps text unparsed, so you just need to grab the string between theCDATA[and]]>parts. That's your lyric URL.
内容的提问来源于stack exchange,提问作者Nhat Ngo
相关产品推荐
相关产品推荐

