Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解析库html的querySelector方法中支持 nth-child的疑惑 #10

Closed
wjploop opened this issue Jan 23, 2021 · 4 comments
Closed

解析库html的querySelector方法中支持 nth-child的疑惑 #10

wjploop opened this issue Jan 23, 2021 · 4 comments

Comments

@wjploop
Copy link

wjploop commented Jan 23, 2021

我了解到html在使用querySelector()方法中并没有支持nth-child,(该库似乎正在添加这个支持),可是我看到您代码已经存在使用了,如下

    detailModel.nodeId = document
        .querySelector(
            '#Wrapper > div > div:nth-child(1) > div.header > a:nth-child(6)')
        .attributes["href"]

想知道这是为什么呢?

@w4mxl
Copy link
Owner

w4mxl commented Jan 25, 2021

@wjploop
Copy link
Author

wjploop commented Feb 3, 2021

这个注释之前看过了,看的不是很明白,注释的意思不是说不支持的Selector会抛出UniplmentedError吗,我这边是解析后无结果;选择器的参数(正则表达式?不懂怎么称呼这个),试了你的或从浏览器拷出来都一样无果。

感觉浪费了很多时间精力在解析html,有点得不偿失了。

@wjploop wjploop closed this as completed Feb 3, 2021
@w4mxl
Copy link
Owner

w4mxl commented Feb 4, 2021

这个注释之前看过了,看的不是很明白,注释的意思不是说不支持的Selector会抛出UniplmentedError吗,我这边是解析后无结果;选择器的参数(正则表达式?不懂怎么称呼这个),试了你的或从浏览器拷出来都一样无果。

感觉浪费了很多时间精力在解析html,有点得不偿失了。

解析 Html 这块,当初刚开始摸索的时候是确实费了好大劲。通了一个之后,依葫芦画瓢就好多了

@ismanong
Copy link

ismanong commented Dec 4, 2021

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants