Xpath, can you get rid of the js code?

A nasty piece of html code that writes js in div. It"s a keyboard paging code

xpath

found that the tagged content in

is gone, like this

I am China person

what I get is: I am human. China does not have
, and then some people say that my xpath ("/ / p/text ()") this text is preceded by an extra /, written as
xpath (". / / p//text ()"), so that it becomes "I am Chinese", but this js comes in again, painful.
ask me, I just want text, without any tags, no js code, how to write this xpath?
add a
data.xpath ("string (.)"). Extract () [0]). This method doesn"t work. The js tag is removed, but the code is still there.

Mar.11,2021

for deleting < script > elements:

1) you can refer to this article and delete the < script > element with the strip_elements function:
https://www.cnblogs.com/XD00/.

.

2) or you can refer to method 2 of this article and use lxml's Cleaner to Filter:
https://www.jianshu.com/p/26e.


Fuck, prestige is-1, and probably no one will come. I hope this website will close down soon

.
Menu