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的效果
span用個style看看??
span test
黑幕效果!
這玩意div可以搞text-align應該可以適配所有css吧
hello 自動滾動overflow:auto 1 2 3 4
TRY TO MAKE A REAL THInG!
標題文本 | 標題文本 | 標題文本 |
---|---|---|
示例 | 示例 | 示例 |
示例 | 示例 | 示例 |
示例 | 示例 | 示例 |
- include <bits/stdc++.h>
- 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 << "
「 | " << data[t][9] << " | 」 |
\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 << "
\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("编辑成功")
- 從命令行參數獲取傳入的參數
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]
- 調用主函數並傳入參數
main(cookie_session, cookie_userid, login_username, login_password, skip_exists, edit_title, edit_text)