惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
G
Google Developers Blog
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
T
The Blog of Author Tim Ferriss
I
InfoQ
MyScale Blog
MyScale Blog
V
V2EX
B
Blog
罗磊的独立博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 疯吻IT

timestamp for this request was 1000ms ahead of the server's time GitHub无法访问、443 Operation timed out的解决办法 - 疯吻IT Ccxt: ModuleNotFoundError:没有名为“ ccxt”的模块 机器翻译数据集 CENTOS手动安装修复python ,YUM CENTOS手动安装修复YUM Python3 找不到库 UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 0: ordinal not in range(128) 数据集 rnn_model.fit Incompatible shapes Mysql 密码过期 帝国cms打开慢 如何快速获得权重站 HTTP 404 Not Found Error with .woff or .woff2 Font Files php报错 syntax error, unexpected T_VARIABLE 修改帝国cms栏目后,如何更新 帝国cms更新报错解决办法 帝国cms 不能正常显示最新文章 帝国CMS Table '***.phome_ecms_news_data_' doesn't exist 多版本python及多版本pip使用 python 去重
用python 发 帝国cms 文章
疯吻IT · 2018-09-27 · via 博客园 - 疯吻IT

在e\extent下面放一个jiekou.php

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import time
import urllib.request
import urllib.parse


def post(title, content, catid):
    query = "http://127.0.0.1/e/extend/jiekou.php?pw=123456"
    data_form = {
        "enews": "AddNews",
        "classid": catid,  # 栏目id
        "bclassid": 0,  # 父栏目id
        "id": 0,
        "filepass": int(time.time()),  # 发布文章的时间戳
        "username": "admin",
        "oldchecked": 1,
        "ecmsnfrom": 1,
        "ecmscheck": 0,
        "havetmpic": 0,
        "title": title,
        "checked": 1,
        "isgood": 0,
        "firsttitle": 0,
        "newstime": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
        "writer": "admin",
        "befrom": "",
        "newstext": content,
        "dokey": 1,
        "copyimg": 1,
        "autosize": 5000,
        "istop": 0,
        "newstempid": 0,
        "groupid": 0,
        "userfen": 0,
        "onclick": 0,
        "totaldown": 0,
        "addnews": "提 交",
    }
    data = urllib.parse.urlencode(data_form).encode(encoding='utf-8')
    req = urllib.request.Request(query, data=data)
    res = urllib.request.urlopen(req, timeout=10)
    result = res.read().decode('utf-8')
    print(result)

if __name__ == "__main__":
    content_list = [line.strip() for line in open("duanwenxue.txt")]
    for wz in content_list[:5]:
        text = wz.split("####")
        title = text[0]
        content = text[1]
        print("开始发布:", title)
        post(title, content, 1)

参考:

如何用MarsEdit快速插入源代码