如何使用scrapy从python中的javascript onclick属性获取href值?

时间:2018-05-15 08:07:04

标签: javascript python-2.7 scrapy

<td class="headerStyle">
   <input type="image" 
       name="ctl00$ContentPlaceHolder1$gvfacletails$ctl19$lnkView" 
       id="lnkView" title="View" src="images/view.png" 
       onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$gvfaculetails$ctl19$lnkView", "", false, "", "viewculty.aspx?FacultyID=Li9S-20151", false, false))">
</td>

如何使用scrapy从python中的javascript viewculty.aspx?FacultyID=Li9S-20151上面提取此href onclick

1 个答案:

答案 0 :(得分:1)

const float max_dist = 300.0;

vec2  touch      = vec2(u_TouchX, u_ResolutionY - u_TouchY);
vec2  touch_dist = abs(touch - gl_FragCoord.xy);

float smootTouch = smoothstep(0.0, max_dist, length(touch_dist));
float finalC     = max(0.0, 1.0-smootTouch);

上面我正在使用正则表达式并搜索href = response.xpath('//input[@id="lnkView"]/@onclick').re_first( r'([^"]+\?[^"]+)' ) 和周围未加引号的符号