最近遇到了一个问题,我之前在notion里收藏了一些youtube博主的链接和id,我并没有订阅(我收藏的是某个类型的博主,不想和youtube其他订阅的博主混在一起,并且我也懒得打开一个一个订阅了),以前可能会不定时的打开看看博主是否有更新,但获取信息不怎么及时。
所以我就在想,是否有一个办法,每天定时获取这些博主的更新,比如每天晚上8点,通过telegram bot发消息,告知我今天列表里有哪些博主更新了,更新了什么内容。

那其实用make自动化工具,就可以实现这个需求了。具体怎么做,下面我说说步骤

1、前期准备
我们需要先新建notion的api,目的是为了可以获取到notion的数据
地址:https://www.notion.so/my-integrations
我们新建一个integration,选择你需要开放权限的workspace,然后你会获取一串api secret,保存好这个api secret

然后打开notion,在你需要获取信息的页面,去连接到你刚创建的integration

连接好之后,即你可以通过api去获取到这个表格的信息了。

另外,表格的id也复制并记录下来,后面会用到。

2、在make里新建notion节点
点击新建,选择notion
然后在notion里选择search objects这个动作

具体的配置页面如下,objects我们选择database items,database id我们就把上一步复制的id黏贴到这里读取数据,最后,在property里会加载出对应table 的字段,比如我们需要表格里ID这一列,那么在field我们就选择id(后面我们需要通过ID来获取到youtube频道主的信息)

3、设置变量
我们把从notion里获取到的ID值设置成一个变量
在notion节点后新增一个set variable的节点

value这里,我们在右侧选择到ID这个值,右侧这个弹框里就是从notion api获取到的所有信息

4、http获取youtube频道主信息
我们有了youtube频道主的频道id,并且id已经保存成变量,那么这一步就要通过频道id来去获取youtube频道主的信息了。
如下,url这里,我们根据youtube的api拼接起来

url含义大概是这样:
- https://www.googleapis.com/youtube/v3/search 这个是http的请求地址
- part=snippet 用于指定 API 响应将包含的一个或多个
search资源属性的逗号分隔列表 - type=video 搜索查询限制为仅为video
- maxResults=1 返回最大值为1
- order=date 资源按照创建时间倒序排列
- channelId={变量} ,这个变量我们就选到上一步的变量名即可
- key={your_api_key} key就是api秘钥,把{your_api_key}替换成你自己的key即可
运行之后你就可以看到结果了,data就包含了youtube频道主的信息了

5、解析json
我们再添加一个json节点,选择解析json,然后把从http获取到的data进行解析

从output里可以看到解析的结果了

好的,那么接下来我们的需求是,我希望在我执行工作流的时候,只把notion列表里的频道主当天更新的视频发送给我。当天没更新就忽略。
所以逻辑就是,如果我获取到的频道主最新的视频的日期是当天的,就发telegram bot给我,如果不是,就忽略。
然后,我们看接下来的步骤
6、设置变量
这一步的目的是我要去到频道主新视频的发布日期,并设置成变量

我们就选择publishedat这个字段,把它变成一个变量
7、更改日期格式
细心的话你会发现,publishedat的格式是年月日时分秒,但是我们和当天日期对比的话,只需要到年月日就可以了
所以,我们需要把publishedat的格式变化一下
同样的我们新增一个变量节点

value这里我们用一个函数解决,formatDate(45.{publishedat}; “YYYY-MM-DD”),这个函数的意思就是把publishedat的格式变成年月日

运行后发现,日期已经成功的变成年月日了
8、发送telegram bot消息,并设置判断条件

这里有两个地方
(1)新增telegram bot节点
(1)新增telegram bot节点
如下,我们配置好chatid和text内需要显示的内容

(2)在连接线添加判断条件
当发布日期=执行流程当天时,才需要发送消息

所以在这里我们设置一个条件
当上一步的变量日期(改成年月日格式的publishedat)=当天(当天这里的格式也改成年月日,同样的函数)
好了,那么配置的工作就结束了,当你点击run的时候,如果notion列表里你收藏的博主在当天有更新视频的话,telegram bot就会把视频的具体信息发送给你。

telegram bot信息如下:

最后你可以开启这个流程,并且选择流程执行的规则,比如是每天固定某个时间点执行等

视频介绍:



I do enjoy the manner in which you have presented this particular issue plus it does present me personally some fodder for thought. Nevertheless, because of what precisely I have experienced, I simply just trust as other feed-back pile on that individuals remain on point and in no way embark upon a soap box involving some other news du jour. Anyway, thank you for this excellent point and even though I can not really go along with the idea in totality, I regard the point of view.
excellent points altogether, you simply gained a new reader. What would you recommend about your post that you made a few days ago? Any positive?
Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.
Some truly choice content on this internet site, saved to my bookmarks.
I?¦m no longer certain the place you’re getting your information, however good topic. I must spend a while finding out more or working out more. Thank you for magnificent information I was searching for this information for my mission.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Điểm nổi bật của slot365 không chỉ nằm ở giao diện thân thiện, tốc độ xử lý mượt mà trên cả điện thoại và máy tính, mà còn ở công nghệ bảo mật tiên tiến, giúp người dùng yên tâm sử dụng dịch vụ mọi lúc mọi nơi. Đặc biệt, deegarciaradio.com hoạt động hợp pháp dưới sự cấp phép của tổ chức PAGCOR – Philippines, đảm bảo yếu tố minh bạch và ổn định trong quá trình vận hành.
Pretty nice post. I just stumbled upon your weblog and wished to say that I have truly enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again very soon!