问题描述
我使用Twitter。有些人的鸣叫包含照片,我想救他们。
I use twitter. Some people's tweets contain photos and I want to save them.
我查了IFTTT,其中Twitter是不是一个触发器。因此,IFTTT不能帮我做。
I checked ifttt, where twitter is not a trigger. Thus, ifttt cannot help me do it.
一个想法可能是使用JavaScript。我使用Firefox和Greasemonkey的安装。我可以写在Twitter网站上的Greasemonkey脚本(JavaScript)的运行。当我点击转推链接,或通过我的脚本添加其他按钮,我的脚本检查鸣叫的内容,发现照片的URL,并将其保存到我的磁盘。
One idea is probably to use JavaScript. I use Firefox and installed Greasemonkey. I can write a Greasemonkey script (JavaScript) running on twitter website. Once I click "retweet" link or other button added by my script, my script examines the content of the tweet, find the URL of the photo, and save it to my disk.
的一个问题是如何保存的图像。我在网上搜索了。有些使用 win.document.execCommand(另存为)
,它会显示一个另存为窗口。现在,窗口显示,为什么不直接右键点击图片并选择以手工救?所以,我不喜欢的方式。
One problem is how to save the image. I searched the Internet. Some use win.document.execCommand("SaveAs")
, and it will show a "save as" window. Now that the window shows, why not just right click the image and choose save as manually? So I don't like the method.
有什么建议?
推荐答案
的Greasemonkey不能做到这一点,因为普通的JavaScript是禁止这样做(出于安全原因),和的不公开方法Greasemonkey的API来编写文件(可能永远也不会)。
Greasemonkey cannot do this, because ordinary javascript is forbidden to do this (for security reasons), and the Greasemonkey API does not expose a method to write files (and probably never will).
下面有三种选择:
-
安装和使用。它仍然需要一个点击,不过这不是总是抓住一个文件更好的威利愿意不愿意,在大多数情况下,无论如何。
Install and use the excellent DownThemAll add-on. It still requires one click, but that's better than always grabbing a file willy nilly, in most cases anyway.
或
编写您自己的插件。 。
Write your own addon. See this answer for file-writing code from one of the top gurus of FF add-ons.
或
使用(或类似)上运行的Web服务器的机。然后,您将必须编写节选传入的图像数据(或者仅仅是图像URL)以及图像保存到磁盘的Web应用程序。
Use XAMPP (or similar) to run a web server on your machine. You will then have to write a web application that excepts incoming image data (or just the image URL) and saves the image to disk.
您还必须编写的图像数据发送到您的Web应用程序Greasemonkey的脚本。
You will also have to write a Greasemonkey script that sends the image data to your web app.
这篇关于将影像保存到硬盘,而不进行提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!