0

I am trying to extract DetailID value from the html for example view-source:http://www.hgtv.com/

mdManager.addParameter("DetailID", "466c141156dd2b88eeffedd780cf9126");

output should be 466c141156dd2b88eeffedd780cf9126

i am currently using re.search and its takes a while to search Here is my code

searchObj = re.search( r'(.*)DetailID\",(\s\")(.*)(\"\))', html_source_code.text, re.M|re.I)
print(searchObj.group(3))

Is there a better way to get the result faster

codeexplorer
  • 409
  • 1
  • 6
  • 19

1 Answers1

0

The following worked

regex = re.compile(r'DetailID", "(.*)(\"\))')
detailId =  regex.search(source_code.text).group(1)
codeexplorer
  • 409
  • 1
  • 6
  • 19