在Automator工作流程中获取Web文章的标题 [英] Grab the title of a web article within Automator workflow

查看:114
本文介绍了在Automator工作流程中获取Web文章的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个工作流,该工作流使用Instapaper将URL列表转换为纯文本,然后将文本保存在计算机上的文本文档中.

I am trying to create a workflow that converts a list of URLs into plain text using Instapaper, and then saves the text in text documents on my machine.

到目前为止,我已经能够获取URL列表,对其进行转换并保存文本文档.问题是我不知道如何使用每个网页的名称作为后续文档的名称.

So far, I have been able to grab the list of URLs, convert them, and save text documents. The problem is that I can't figure out how to use the name of each web page as the name of the subsequent document.

我使用我的Instapaper RSS URL来获取文章.然后,我使用从文章获取链接URL",然后使用Applescript将其转换为纯文本版本. 从网页获取文本"将获取文本. 新文本文件"允许我保存每个文档,但是它们都具有相同的名称,即我在新文本文件"操作中的另存为"输入中输入的名称.

I use my Instapaper RSS URL to grab the articles. Then I use "Get Link URLs from Articles" followed by an Applescript to convert to the plain text version. "Get Text from Webpage" grabs the text. "New Text File" allows me to save each document, but they all have the same name, the one I entered into the Save As input in the New Text File action.

我该怎么做才能将文档另存为每个网页的标题?

How might I have that action save the documents as each webpage's title?

推荐答案

如果您向此AppleScript传递URL,它将返回页面标题...

If you pass this AppleScript a URL it should return the title of the page...

on run {input, parameters}
    set pageTitle to do shell script "curl " & quoted form of (first item of input) & " | grep -o \\<title\\>.*\\</title\\> | sed -E 's/<\\/?title>//g'"
    return pageTitle
end run

这篇关于在Automator工作流程中获取Web文章的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆