V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lueffy
V2EX  ›  科技

想要将豆瓣读书/观影的数据同步到 trello 或者其他 todo 类工具中,有好的方法思路嘛?

  •  
  •   lueffy · 2019-07-26 11:53:09 +08:00 · 841 次点击
    这是一个创建于 1707 天前的主题,其中的信息可能已经有所发展或是发生改变。

    豆瓣公共 api 已经关闭了,想读 /在读 /已读的数据不是 json 类型而是 html,所以想到的办法就是解析,然后调用 trello 的接口导入

    $('li.item div.title a').each(function(){
        var requestData = {
            "name": $(this).text().trim(),
            "pos": 327679,
            "key": "1c83f41a065ce80fdc9f3e262fe4****",
            "closed": false,
            "idLabels": [],
            "idMembers": [],
            "dateLastActivity": 1564110896700,
            "idBoard": "5c46f6ee48100d3d063cf864",
            "idList": "5c46f6fcd44bb753948484bf",
            "token": "f447933aae48a9d62efd7e9b8ce7c427f919d2e391ff4e2b4ba79291aa09****"
        }
        $.ajax({
            url: "https://trello.com/1/cards",
            type: "POST",
            contentType: "application/json", 
            dataType:"json",
            data:JSON.stringify(requestData),
            success: function () {
                console.log($(this).text()+"导入成功")
            }
        });
    })
    

    其中 key token 需要从 trello api 中获取

    image.png image.png

    把代码粘到 console 里运行一下就行,可行是可行,但是这个方法好笨啊,并且不是实时同步,求更优解?

    1 条回复    2019-07-26 11:56:53 +08:00
    lueffy
        1
    lueffy  
    OP
       2019-07-26 11:56:53 +08:00
    IFTTT 可行?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3513 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 10:50 · PVG 18:50 · LAX 03:50 · JFK 06:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.