我想从下面的 html 代码中抓取 link,但不知道该怎么做,因为它在括号中
I want to scrape the link from the html code below, but do not know how to do that because it is in the brackets
这是 html 代码,我想从中抓取 YouTube 视频的 link。但是我不知道怎么做,有知道的请回答我。
<button id='btnWatchLikeAndSubscribe' class='greenButton button' style='font-
size: 18px;'
onclick="newtab =openWin('http://www.youtube.com/watch?v=lZenDvvS5WM');
enableWatchTimer();">1.
<i class='fa fa-eye'></i>  Watch, Like & Subscribe</button>
您可以使用正则表达式:
import re
match = re.search(r'''openWin\(('(?P<url>[^']*)')\)''',TEXT_OF_BUTTON)
url = match.groupdict().get('url') if match else None
这是 html 代码,我想从中抓取 YouTube 视频的 link。但是我不知道怎么做,有知道的请回答我。
<button id='btnWatchLikeAndSubscribe' class='greenButton button' style='font-
size: 18px;'
onclick="newtab =openWin('http://www.youtube.com/watch?v=lZenDvvS5WM');
enableWatchTimer();">1.
<i class='fa fa-eye'></i>  Watch, Like & Subscribe</button>
您可以使用正则表达式:
import re
match = re.search(r'''openWin\(('(?P<url>[^']*)')\)''',TEXT_OF_BUTTON)
url = match.groupdict().get('url') if match else None