Giter VIP home page Giter VIP logo

Comments (3)

zjuchenyuan avatar zjuchenyuan commented on May 18, 2024 3

https://help.flomoapp.com/basic/storage.html
flomo导出的数据是html格式的,如何导入到memos?

今天看到一个仓库 Flomo To Json。还没测试,不知道导出的json格式是否兼容

尝试了一下发现有个小bug:部分memo输出的content会内容重复 例如a b会变成a a b b,需要注意一下

import json, csv, time
from datetime import datetime
def time2ts(x):
    return int(datetime.strptime(x, "%Y-%m-%d %H:%M:%S").timestamp())
res = [["id","creator_id","created_ts","updated_ts","row_status","content","visibility"]]
for idx,i in enumerate(json.load(open("myMemos.json"))):
    contents = i["content"]
    if not contents:
        continue
    c = [contents[0]]
    oldline = contents[0]
    for line in contents:
        if line==oldline:
            continue
        oldline = line
        c.append(line)
    res.append([1005+idx, 101, time2ts(i["time"]), time2ts(i["time"]), "NORMAL", "\n".join(c)+" ", "PRIVATE"])
csv.writer(open("out.csv", "w")).writerows(res)

我写了这个简单的python来转换为csv格式,然后用navicat手动导入了一下(从服务器复制db文件 navicat打开 对memo表导入 db文件复制到服务器替换) 效果还行
没有处理附件图片,其中1005需要改成当前表格最大id+1,101为authorid只有一个账号的话就是101,导入的content末尾加个空格是发现memos目前不会把末尾的tag认为是tag,除非加上了空格

from memos.

Laifang avatar Laifang commented on May 18, 2024 1

因为涉及到编码问题,我在这位作者的源代码基础上添加上了UTF-8编码参数,经测试使用没有问题

import json, csv, time
from datetime import datetime
def time2ts(x):
    return int(datetime.strptime(x, "%Y-%m-%d %H:%M:%S").timestamp())
res = [["id","creator_id","created_ts","updated_ts","row_status","content","visibility"]]
for idx,i in enumerate(json.load(open("myMemos.json",encoding="UTF-8"))):
    contents = i["content"]
    if not contents:
        continue
    c = [contents[0]]
    oldline = contents[0]
    for line in contents:
        if line==oldline:
            continue
        oldline = line
        c.append(line)
    res.append([1005+idx, 101, time2ts(i["time"]), time2ts(i["time"]), "NORMAL", "\n".join(c)+" ", "PRIVATE"])
csv.writer(open("out.csv", "w",encoding="UTF-8")).writerows(res)

from memos.

yylqing avatar yylqing commented on May 18, 2024

https://help.flomoapp.com/basic/storage.html

flomo导出的数据是html格式的,如何导入到memos?

今天看到一个仓库 Flomo To Json。还没测试,不知道导出的json格式是否兼容

from memos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.