I need to get the value from the FLVPath from this link : http://www.testpage.com/v2/videoConfigXmlCode.php?pg=video_29746_no_0_extsite
from lxml import html
sub_r = requests.get("http://www.testpage.co/v2/videoConfigXmlCode.php?pg=video_%s_no_0_extsite" % list[6])
sub_root = lxml.html.fromstring(sub_r.content)
for sub_data in sub_root.xpath('//PLAYER_SETTINGS[@Name="FLVPath"]/@Value'):
print sub_data.text
But no data returned
You’re using
lxml.htmlto parse the document, which causes lxml to lowercase all element and attribute names (since that doesn’t matter in html), which means you’ll have to use:Or as you’re parsing a xml file anyway, you could use
lxml.etree.