ludoux / ngapost2md

艾泽拉斯国家地理论坛/NGA玩家社区/NGA单帖爬虫/牛国安一键存贴,不怕冲水
MIT License
98 stars 10 forks source link

reply to代码块后面应加换行符 #7

Closed crella6 closed 3 years ago

crella6 commented 4 years ago

见截图,网页版有换行,但是生成的markdown没有换行。 https://s1.ax1x.com/2020/08/23/dB1jGn.jpg

ludoux commented 4 years ago

谢谢 @crella6 。当时在一直没有找到测试的例子,没有考虑到换行问题。

ludoux commented 4 years ago

暂时先强制 reply 补两个回车先,下次更新判断后面有无跟随两个 <br> 或者 </br>,没有的话再补(防止多出来换行)。

crella6 commented 4 years ago
import re
raw = '''[b]Reply to [pid=447497734,23090510,1]Reply[/pid] Post by [uid]#anony_fb9d9b8dd3d159d0a2e68a2f45b39e59[/uid][color=gray](4楼)[/color] (2020-08-24 15:30)[/b]<br/>这个最简单了 分开审问 姓名 电话 有微信聊天记录吗 什么时候认识的 两人对不上就是撒谎'''
# https://bbs.nga.cn/read.php?tid=23090510&_fp=2&page=2&lite=js
rex = re.findall(
      r'\[b\]Reply to .+? Post by \[uid.*?\](.+?)\[\/uid\] \((.+?)\)\[\/b\]', raw, flags=re.S)

上面的正则匹配失败了

ludoux commented 4 years ago

😅😅😅太难,我之后整一下正则,谢谢你

获取 Outlook for Androidhttps://aka.ms/ghei36


From: crella6 notifications@github.com Sent: Monday, August 24, 2020 5:29:06 PM To: ludoux/ngapost2md ngapost2md@noreply.github.com Cc: Lu Chang chinaluchang@live.com; Comment comment@noreply.github.com Subject: Re: [ludoux/ngapost2md] reply to代码块后面应加换行符 (#7)

import re

raw = '''[b]Reply to [pid=447497734,23090510,1]Reply[/pid] Post by [uid]#anony_fb9d9b8dd3d159d0a2e68a2f45b39e59[/uid]color=gray[/color] (2020-08-24 15:30)[/b]
这个最简单了 分开审问 姓名 电话 有微信聊天记录吗 什么时候认识的 两人对不上就是撒谎'''

https://bbs.nga.cn/read.php?tid=23090510&_fp=2&page=2&lite=js

rex = re.findall(

  r'\[b\]Reply to .+? Post by \[uid.*?\](.+?)\[\/uid\] \((.+?)\)\[\/b\]', raw, flags=re.S)

上面的正则匹配失败了

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ludoux/ngapost2md/issues/7#issuecomment-679016861, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADGWKTF547AJGR2YF4MPGKDSCIXGFANCNFSM4QIWXJUQ.

ludoux commented 4 years ago

"content":"[quote][pid=447730095,23101922,1]Reply[/pid] [b]Post by [uid=62457808]小目标坐牢了[/uid] (2020-08-25 14:08):[/b]<br/><br/>带夜视功能的高清摄像头都要装的,毕竟公共场所。不过只要没出事也没人盯着监控看[/quote]<br/>我在里面打炮 你们是看看就算了 还是会来制止啊。。" 也是换行符问题

ludoux commented 3 years ago
import re
raw = '''[b]Reply to [pid=447497734,23090510,1]Reply[/pid] Post by [uid]#anony_fb9d9b8dd3d159d0a2e68a2f45b39e59[/uid][color=gray](4楼)[/color] (2020-08-24 15:30)[/b]<br/>这个最简单了 分开审问 姓名 电话 有微信聊天记录吗 什么时候认识的 两人对不上就是撒谎'''
# https://bbs.nga.cn/read.php?tid=23090510&_fp=2&page=2&lite=js
rex = re.findall(
      r'\[b\]Reply to .+? Post by \[uid.*?\](.+?)\[\/uid\] \((.+?)\)\[\/b\]', raw, flags=re.S)

上面的正则匹配失败了

这个还没有解决。

换行问题通过替换可能的两个换行符,再手动补两个来尝试解决。

ludoux commented 3 years ago

https://github.com/ludoux/ngapost2md/commit/ebb69b4ebc4f30c77342b61c89b692806107c3d4#r42822914 -> Close #7