V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lueffy
V2EX  ›  科技

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

  •  
  •   lueffy · Jul 26, 2019 · 1432 views
    This topic created in 2477 days ago, the information mentioned may be changed or developed.

    豆瓣公共 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 replies    2019-07-26 11:56:53 +08:00
    lueffy
        1
    lueffy  
    OP
       Jul 26, 2019
    IFTTT 可行?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   970 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:18 · PVG 06:18 · LAX 15:18 · JFK 18:18
    ♥ Do have faith in what you're doing.