• export-import
  • 掘金文章导出 文章迁移工具
  • foreach
  • new
  • import dialog
  • 59 csdn export-import 导入
  • export-import

    掘金文章导出 文章迁移工具

    http://zentao.uninote.com.cn/zentao/task-view-20.html
    X:\fe\juejin-crawler.js
    function doxhr(url, params, callback) {
        var http = new XMLHttpRequest();
        http.withCredentials = true;
        http.open("POST", url, true);
        http.setRequestHeader("Content-type", "application/json");
        http.onreadystatechange = callback
        http.send(JSON.stringify(params));
    }
    let params = {
        cursor: "0",
        sort_type: 2,
        // user_id: "2963939080278109",
    }
    doxhr('https://api.juejin.cn/content_api/v1/article/query_list', params, (res)=>{
        // console.log(res);   
        if (res.currentTarget.readyState === 4) {
            let data = JSON.parse(res.currentTarget.response).data;
            // console.log(data);
            data.forEach((item,index,arr)=>{
                if (index > 1) return;
                let info = item.article_info;
                console.log(item.article_id, info.draft_id, info.title);
                doxhr('https://api.juejin.cn/content_api/v1/article_draft/detail', {
                    draft_id: item.article_info.draft_id
                }, (res)=>{
                    if (res.currentTarget.readyState === 4) {
                        let data = JSON.parse(res.currentTarget.response).data;
                        // console.log(data);
                        console.log(data.article_draft.mark_content)
                    }
                }
                )
            }
            );
        }
    }
    );

    foreach

    function doxhr(url, params, callback) {
        var http = new XMLHttpRequest();
        http.withCredentials = true;
        http.open("POST", url, true);
        http.setRequestHeader("Content-type", "application/json");
        http.onreadystatechange = callback
        http.send(JSON.stringify(params));
    }
    for (let cursor = 0; cursor < 30; cursor += 10) {
        let params = {
            cursor: cursor + "",
            sort_type: 2,
            user_id: "2963939080278109",
        }
        doxhr('https://api.juejin.cn/content_api/v1/article/query_list', params, (res)=>{
            // console.log(res);   
            if (res.currentTarget.readyState === 4) {
                let data = JSON.parse(res.currentTarget.response).data;
                // console.log(data);
                data.forEach((item,index,arr)=>{
                    if (index > 1)
                        return;
                    let info = item.article_info;
                    console.log(item.article_id, info.draft_id, info.title);
                    doxhr('https://api.juejin.cn/content_api/v1/article_draft/detail', {
                        draft_id: item.article_info.draft_id
                    }, (res)=>{
                        if (res.currentTarget.readyState === 4) {
                            let data = JSON.parse(res.currentTarget.response).data;
                            console.log(data);
                            //console.log(data.article_draft.mark_content)
                        }
                    }
                    )
                }
                );
            }
        }
        );
    }
    function doxhr(url, params, callback) {
        var http = new XMLHttpRequest();
        http.withCredentials = true;
        http.open("POST", url, true);
        http.setRequestHeader("Content-type", "application/json");
        http.onreadystatechange = callback
        http.send(JSON.stringify(params));
        return http;
    }
    onePage = async(cursor)=>{
        let allRes = [];
        let params = {
            cursor: cursor + "",
            sort_type: 2,
            user_id: "2963939080278109",
        }
        let pAll = new Promise((resolve,reject)=>{
            doxhr('https://api.juejin.cn/content_api/v1/article/query_list', params, (res)=>{
                // console.log(res);   
                if (res.currentTarget.readyState === 4) {
                    let pDetails = [];
                    let data = JSON.parse(res.currentTarget.response).data;
                    // console.log(data);
                    data.forEach((item,index,arr)=>{
                        if (index > 1)
                            return;
                        let info = item.article_info;
                        console.log(item.article_id, info.draft_id, info.title);
                        let pOne = new Promise((resolve,reject)=>{
                            doxhr('https://api.juejin.cn/content_api/v1/article_draft/detail', {
                                draft_id: item.article_info.draft_id
                            }, (res)=>{
                                if (res.currentTarget.readyState === 4) {
                                    let data = JSON.parse(res.currentTarget.response).data;
                                    console.log(data);
                                    //console.log(data.article_draft.mark_content)
                                    resolve(data);
                                }
                            }
                            )
                        }
                        )
                        pDetails.push(pOne);
                    }
                    );
                    Promise.all(pDetails).then(()=>{
                        resolve(pDetails);
                    }
                    );
                }
            }
            );
        }
        );
        pAll.then((res)=>{
            console.log('one page finished', res);
        }
        );
    }
    async function main() {
        let cursor = 0;
        while (true) {
            await onePage(cursor);
            cursor += 10;
        }
    }
    main();

    new

    $this->articleModel = ArticleModel::find()->where(['uid' => $uid, 'article_id' => $file])->one();
    上面说到,CORS请求默认不发送Cookie和HTTP认证信息。如果要把Cookie发到服务器,一方面要服务器同意,指定Access-Control-Allow-Credentials字段。
    出现这个报错信息很可能是你在前端设置了withCredentials = true;
    E:\back\git\mynote\nginx\dev.conf
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers *;
        add_header Access-Control-Allow-Methods 'GET,POST';
        add_header Access-Control-Allow-Headers 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    mynote x-www-form-urlencoded
    Access-Control-Allow-Origin设置多个域名
    https://www.cnblogs.com/zipon/p/10722686.html
    Access-Control-Allow-Origin只能返回一个。

    import dialog

    el-dialog 
    注意 header 的fixed 定位
    el-dialog 需要独立的 stacking context
    lv1= lv2= type=

    59 csdn export-import 导入

    http://zentao.uninote.com.cn/zentao/task-view-59.html
    E:\uninote\test
    文章详情接口有签名
    https://www.csdn.net/all.html