用户:ColGem/沙盒

来自有兽档案馆

big的效果我看看这是啥[![Page Views Count](https://badges.toozhao.com/badges/01HCPXVE3FDS9V56H4FE4FZ58P/green.svg)](https://badges.toozhao.com/stats/01HCPXVE3FDS9V56H4FE4FZ58P "Get your own page views count badge on badges.toozhao.com")

span的效果span的效果

鹿人店.png

222
111


span用个style看看??

span test

黑幕效果!

漫画第114话

[1] [2]

这玩意div可以搞text-align应该可以适配所有css吧

hello 自动滚动overflow:auto 1 2 3 4



显示文字


TRY TO MAKE A REAL THInG!



标题文本
标题文本 标题文本 标题文本
示例 示例 示例
示例 示例 示例
示例 示例 示例




  1. include <bits/stdc++.h>
  2. include <cstdlib>

using namespace std;

string cookie_session(""); string cookie_userid("125"); string login_username("ColGem"); string login_password("");

std::string escapeString(const std::string& input) { std::string output; for (char c : input) { switch (c) { case '\n': output += "%_\\n\\"; break; case '\t': output += "%_\\t\\"; break; case ' ': output += "%_\\20\\"; default: output += c; break; } } return output; }


int wiki_edit(string title, string wikitext, string skip_exists) { std::string command = "python wikiedit_cppUse.py "; command += cookie_session; command += " "; command += cookie_userid; command += " "; command += login_username; command += " "; command += login_password; command += " "; command += skip_exists; command += " "; command += "\"" + title + "\""; command += " "; command += "\"" + escapeString(wikitext) + "\""; cout<<title<<":"; int result = std::system(command.c_str()); printf("\n"); if (result == 0) return 0; // 成功 else return 1; // 失败 }


std::string formatDate(const std::string& dateStr, char split) { std::stringstream ss(dateStr); std::string year, month, day; std::getline(ss, year, split); std::getline(ss, month, split); std::getline(ss, day, split);

std::string formattedDate = year + "年" + month + "月" + day + "日"; return formattedDate; }

std::string replacePercent20(const std::string& str) { std::string result; std::string pattern = "%20"; size_t pos = 0; size_t prevPos = 0; while ((pos = str.find(pattern, prevPos)) != std::string::npos) { result += str.substr(prevPos, pos - prevPos); result += ' '; prevPos = pos + pattern.length(); } result += str.substr(prevPos); return result; }

std::string replaceChar(const std::string& str, char oldChar, char newChar) { std::string result = str; std::replace(result.begin(), result.end(), oldChar, newChar); return result; }

int stringToInt(const std::string& str) { int result = 0; int sign = 1; size_t i = 0;

// 处理符号位 if (str[i] == '-' || str[i] == '+') { if (str[i] == '-') sign = -1; i++; }

for (; i < str.length(); i++) { if (str[i] >= '0' && str[i] <= '9') result = result * 10 + (str[i] - '0'); else break; } return result * sign; }

string data[1000][20];

std::string generateWikitext(int t) { t -= 1; std::stringstream wikitext;

wikitext << "

";

int s0 = stringToInt(data[t][0]);

if (s0 % 100 == 0) wikitext << "

";

int s16 = stringToInt(data[t][16]);

if (s16 != -1) wikitext << "

";

wikitext << "

\n"; wikitext << "{{话别信息框\n"; wikitext << "|number=" << s0 << "\n"; wikitext << "|color=#" << data[t][10] << "\n"; wikitext << "|title_weibo=" << data[t][3] << "\n"; wikitext << "|title_bili=" << data[t][4] << "\n"; wikitext << "|image=[[File:第" << s0 << "话标题卡]]\n"; wikitext << "|episode=" << data[t][15] << "\n"; wikitext << "|date_weibo=" << replaceChar(data[t][1], '/', '-') << "\n"; wikitext << "|date_bili=" << data[t][2] << "\n"; wikitext << "}}\n"; if (data[t][9] != "-1") wikitext << "

\n";

if (s0 <= 415) wikitext << "" << data[t][4] << "有兽焉漫画的第" << s0 << "话。它于" << formatDate(data[t][1], '/') << "在微博正式发布,并于2021年1月11日在哔哩哔哩漫画与其他414话一并上线.\n"; else wikitext << "" << data[t][4] << "有兽焉漫画的第" << s0 << "话。它于" << formatDate(data[t][2], '/') << "作为付费章节在哔哩哔哩漫画发布,并于" << formatDate(data[t][1], '-') << "在微博正式发布.\n";

wikitext << "\n==漫画链接==\n"; wikitext << "Template:漫画链接\n\n";

wikitext << "==概要==\n"; wikitext << "===" << data[t][11] << "===\n"; wikitext << data[t][13] << "\n"; if (data[t][12] != "-1" && data[t][14] != "-1") { wikitext << "===" << data[t][12] << "===\n"; wikitext << data[t][14] << "\n\n"; } else if (data[t][12] == "-1" && data[t][14] != "-1") wikitext << data[t][14] << "\n\n";

wikitext << "==出场==\n"; wikitext << "===角色===\n"; wikitext << "Module:QueryCharacters2第9行Lua错误:bad argument #2 to 'format' (number expected, got string) \n\n";

if (data[t][18] != "-1" || data[t][19] != "-1") { wikitext << "==你知道吗?==\n"; wikitext << "===细节===\n"; if (data[t][18] != "-1") wikitext << "*该话有一个普通的细节:" << data[t][18] << "\n\n"; if (data[t][19] != "-1") wikitext << "*该话有一个重要的细节:" << data[t][19] << "\n\n"; }

wikitext << "==参考资料==\n";

wikitext << "

  1. 哈哈哈
  2. 黑幕效果!漫画第114话哈哈哈

\n"; wikitext << "

\n";

wikitext << "

\n";

return wikitext.str(); }


int main() { freopen("csvOut.csv", "r+", stdin); int n; std::cin >> n;

for (int i = 0; i < n; ++i) { string temp_in; for (int j = 0; j < 20; ++j) { std::cin >> temp_in; data[i][j] = replacePercent20(temp_in); } } int t = 524; // std::cin >> t; std::string wikitext = generateWikitext(t); //std::cout << wikitext << std::endl;

wiki_edit("User:ColGem/test2",wikitext, "1");

for(int i=1; i>=524; i++) { std::string wikitext = generateWikitext(i); std::string title = "User:ColGem/第" + to_string(i) + "话"; std::string skip_exists = "1"; wiki_edit(title, wikitext, skip_exists); }

return 0; }




wikiedit_cppUse.py:

import sys import requests

def check_page_existence(page_title):

   url = f"https://youshou.wiki/api.php?action=query&format=json&titles={page_title}"
   response = requests.get(url)
   data = response.json()
   pages = data["query"]["pages"]
   page_info = next(iter(pages.values()))
   page_exists = "missing" not in page_info
   
   return page_exists

def unescape_string(input):

   output = input.replace('%_\\n\\', '\n').replace('%_\\t\\', '\t').replace('%_\\20\\', ' ')
   # 添加其他需要恢复的字符的处理逻辑
   return output

def main(cookie_session_, cookie_userid_, login_username, login_password, skip_exists, edit_title, edit_text):

   edit_text = unescape_string(edit_text);
   check_flag = 0
   if int(skip_exists):
       if check_page_existence(edit_title):
           print("跳过已存在页面")
           check_flag = 1
   if not check_flag:
       url = "https://youshou.wiki/api.php"
       cookies = {
           "wiki_ysy_session": cookie_session_,
           "wiki_ysyUserID": cookie_userid_
       }
       # Step 1: 获取登录令牌
       params = {
           "action": "query",
           "meta": "tokens",
           "format": "json",
           "type": "login"
       }
       response = requests.get(url, params=params)
       login_token = response.json()["query"]["tokens"]["logintoken"]
       # Step 2: 登录操作
       data = {
           "action": "login",
           "format": "json",
           "lgname": login_username,
           "lgpassword": login_password,
           "logintoken": login_token
       }
       response = requests.post(url, data=data, cookies=cookies)
       login_response = response.json()
       # Step 3: 检查登录是否成功,并获取编辑令牌
       if "error" in login_response:
           print("登录失败:", login_response["error"]["info"])
       else:
           # 发送新的请求获取编辑令牌
           params = {
               "action": "query",
               "meta": "tokens",
               "format": "json"
           }
           response = requests.get(url, params=params, cookies=cookies)
           csrf_token = response.json()["query"]["tokens"]["csrftoken"]
           # Step 4: 使用编辑令牌进行编辑操作
           data = {
               "action": "edit",
               "format": "json",
               "title": edit_title,
               "text": edit_text,
               "token": csrf_token
           }
           response = requests.post(url, data=data, cookies=cookies)
           edit_response = response.json()
           if "error" in edit_response:
               print("出错:", edit_response["error"]["info"])
           else:
               print("编辑成功")
  1. 从命令行参数获取传入的参数

cookie_session = sys.argv[1] cookie_userid = sys.argv[2] login_username = sys.argv[3] login_password = sys.argv[4] edit_title = sys.argv[6] edit_text = sys.argv[7] skip_exists = sys.argv[5]

  1. 调用主函数并传入参数

main(cookie_session, cookie_userid, login_username, login_password, skip_exists, edit_title, edit_text)