Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sunboy0628
dr_py
提交
b6334561
dr_py
项目概览
sunboy0628
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
dr_py
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b6334561
编写于
9月 01, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
测试了另外的parsel解析库
上级
c2a16471
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
2 deletion
+31
-2
txt/issue.txt
txt/issue.txt
+3
-0
txt/libs.txt
txt/libs.txt
+2
-1
utils/htmlParser.py
utils/htmlParser.py
+26
-1
未找到文件。
txt/issue.txt
浏览文件 @
b6334561
...
...
@@ -13,6 +13,9 @@ assert subprocess.call(
shell=True,
cwd=DIRNAME) == 0, 'Could not link required node_modules'
另外一个很强的css解析库,性能待验证parsel
https://cuiqingcai.com/202232.html
远程直播地址:
"lives":[{"group":"redirect","channels":[{"name":"直播","urls":["proxy://do=live&type=txt&ext=aHR0cHM6Ly9hZ2l0LmFpL2xjeC8xMS9yYXcvYnJhbmNoL21hc3Rlci9saXZl"]}]}],
下面格式原版tv_box才能用?
...
...
txt/libs.txt
浏览文件 @
b6334561
gevent-websocket
PyExecJS
ddddocr
\ No newline at end of file
ddddocr
parsel # 不知道对比pyquery性能如何,也是css选择器,不好封装成pdfa
\ No newline at end of file
utils/htmlParser.py
浏览文件 @
b6334561
...
...
@@ -68,4 +68,29 @@ class jsoup:
return
self
.
pdfh
(
html
,
parse
,
True
)
def
pq
(
self
,
html
):
return
pq
(
html
)
\ No newline at end of file
return
pq
(
html
)
if
__name__
==
'__main__'
:
import
requests
from
parsel
import
Selector
url
=
'http://360yy.cn'
jsp
=
jsoup
(
url
)
def
pdfa2
(
html
,
parse
):
if
not
parse
:
return
[]
if
parse
.
find
(
'&&'
)
>
-
1
:
parse
=
parse
.
split
(
'&&'
)
# 带&&的重新拼接
# print(f"{parse[0]},{self.test(':eq|:lt|:gt', parse[0])}")
# parse = ' '.join([parse[i] if self.test(':eq|:lt|:gt', parse[i]) or i>=len(parse)-1 else f'{parse[i]}:eq(0)' for i in range(len(parse))])
parse
=
' '
.
join
([
parse
[
i
]
if
jsoup
().
test
(
':eq|:lt|:gt'
,
parse
[
i
])
or
i
>=
len
(
parse
)
-
1
else
f
'
{
parse
[
i
]
}
:nth-child(1)'
for
i
in
range
(
len
(
parse
))])
# print(f'pdfa:{parse}')
selector
=
Selector
(
text
=
html
)
print
(
parse
)
items
=
selector
.
css
(
parse
)
return
[
str
(
item
)
for
item
in
items
]
r
=
requests
.
get
(
url
)
html
=
r
.
text
# parsel 不好用啊,很难实现封装pdfa之类的函数
items
=
pdfa2
(
html
,
'.fed-pops-navbar&&ul.fed-part-rows&&a'
)
print
(
items
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录