我有一个文本文件,其中包含不同的网址,例如网址,图片网址,以及我想用python语言只提取缩略图网址的其他字词?
文本文件数据类似于
{\"pageLoadPingUrl\": \"https:\\/\\/www.bingapis.com\\/api\\/ping\\/pageload?IG=70DEC9E74D99437586013A62D392EB6E&CID=1923A11AB20A622F3EF3AB0AB33B63A7&Type=Event.CPT&DATA=0\"}, \"readLink\": \"https:\\/\\/api.cognitive.microsoft.com\\/api\\/v5\\/images\\/search?q=football\", \"webSearchUrl\": \"https:\\/\\/www.bing.com\\/cr?IG=70DEC9E74D99437586013A62D392EB6E&CID=1923A11AB20A622F3EF3AB0AB33B63A7&rd=1&h=DguPUeDUYz2pg6YQ4vb7fHcxaHr5_zxsw_96_Rf4uJY&v=1&r=https%3a%2f%2fwww.bing.com%2fimages%2fsearch%3fq%3dfootball%26FORM%3dOIIARP&p=DevEx,5226.1\", \"totalEstimatedMatches\": 984, \"value\": [{\"name\": \"... Sallis, \\\"Moving the Movement Football\\\" | Counter-Currents Publishing\", \"webSearchUrl\": \"https:\\/\\/www.bing.com\\/cr?IG=70DEC9E74D99437586013A62D392EB6E&CID=1923A11AB20A622F3EF3AB0AB33B63A7&rd=1&h=DxYxhRhR_W5Ww0BYlGqMNvRtnSpmF6AKMXkf6NmsymM&v=1&r=https%3a%2f%2fwww.bing.com%2fimages%2fsearch%3fview%3ddetailv2%26FORM%3dOIIRPO%26q%3dfootball%26id%3dDCE3B4704C97EC1064A12E7D693389AD809DA302%26simid%3d608014267730954997&p=DevEx,5006.1\", \"thumbnailUrl\": \"https:\\/\\/tse3.mm.bing.net\\/th?id=OIP.Mf0c3eb142508ab40b0a7680f777f452fo0&pid=Api\"
预期产出
https:\\/\\/tse3.mm.bing.net\\/th?id=OIP.Mf0c3eb142508ab40b0a7680f777f452fo0&pid=Api
https:\\/\\/tse3.mm.bing.net\\/th?id=OIP.Mf0c3eb142508ab40b0a73432f777f452fo0&pid=Api
...
这是我所做的代码
def get_net_target(page): start_link=page.find("thumbnailUrl\"" )
start_quote=page.find('"',start_link)
end_quote=page.find('"',start_quote+1)
url=page[start_quote+1:end_quote]
print url