英文:
Go lang executing javascript for retrieving text in page
问题
我正在尝试使用golang从网页中动态加载的文本中检索文本。
要检索的文本位于以下页面:
https://www.protectedtext.com/testretrieve?1234
该文本通过密码进行加密,然后在客户端解密并动态加载到页面上。
我已经尝试使用goquery选择'textarea'对象,但无法获取文本,因为它是动态加载的。
我该如何实现这一点?通过在Go中执行JS?在我的Chrome控制台中可以工作,但不知道如何在Go中实现。
对于我的项目来说,轻量级的解决方案是最好的。或者是否有其他网站可以存储和编辑相同的文本而不修改URL?
英文:
I'm trying to retrieve text that is loaded dynamically from a web page using golang.
The text to retrieve is on this page :
https://www.protectedtext.com/testretrieve?1234
This text is encrypted by a password and then decrypted on client side and loaded dynamically on the page.
I already tried with goquery by selecting 'textarea' object, but I can't get the text cause it's loaded dynamically.
How can I achieve this ? By executing JS in Go ? It's working in my chrome console, but no ideas on how to do that in Go.
A lightweight solution is the best for my project. Or any other website that can store and edit same text without modifying the URL ?
答案1
得分: 1
你可能需要一个无头浏览器来加载JavaScript,例如[phantomgo][1]。
然而,通过查看页面源代码,我们可以看到他们在选项卡标题中使用了sha512
,在文本区域字段中使用了aes
。
英文:
You may need a headless browser to load the javascript like for example [phantomgo][1]
[1]: https://github.com/k4s/phantomgo "phantomgo"
However looking at the page source code we can see that they use sha512
for the tab title and aes
for the textarea field.
答案2
得分: 0
你分享的页面包含 https://www.protectedtext.com/testretrieve?1234,只有一个 class 为 textarea-contents 的元素。使用 goquery 简单获取 class 文档,并获取第 0 个部分。
英文:
The page which you shared contains https://www.protectedtext.com/testretrieve?1234, only one element of class textarea-contents
simple get class documents using goquery and get 0th part
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论