├── Pixiv1.5 ├── Pixiv.pro ├── Pixiv.pro.user ├── main.cpp ├── mylabel.cpp ├── mylabel.h ├── pixiv.cpp ├── pixiv.h └── pixiv.ui ├── Pixiv1.6 ├── Pixiv.pro ├── Pixiv.pro.user ├── main.cpp ├── mylabel.cpp ├── mylabel.h ├── pixiv.cpp ├── pixiv.h └── pixiv.ui └── README.md /Pixiv1.5/Pixiv.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | QT += network 3 | 4 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 5 | 6 | CONFIG += c++14 7 | 8 | # You can make your code fail to compile if it uses deprecated APIs. 9 | # In order to do so, uncomment the following line. 10 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 11 | 12 | SOURCES += \ 13 | main.cpp \ 14 | mylabel.cpp \ 15 | pixiv.cpp 16 | 17 | HEADERS += \ 18 | mylabel.h \ 19 | pixiv.h 20 | 21 | FORMS += \ 22 | pixiv.ui 23 | 24 | # Default rules for deployment. 25 | qnx: target.path = /tmp/$${TARGET}/bin 26 | else: unix:!android: target.path = /opt/$${TARGET}/bin 27 | !isEmpty(target.path): INSTALLS += target 28 | 29 | -------------------------------------------------------------------------------- /Pixiv1.5/main.cpp: -------------------------------------------------------------------------------- 1 | #include "pixiv.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | Pixiv w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Pixiv1.5/mylabel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "mylabel.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | Mylabel::Mylabel(QWidget* parent) 9 | :QLabel(parent) 10 | { 11 | this->setParent(parent); 12 | this->setMouseTracking(true); 13 | this->setObjectName("Mylabel"); 14 | } 15 | 16 | Mylabel::~Mylabel(){ 17 | if (!name) 18 | delete name; 19 | if (!pic_page) 20 | delete pic_page; 21 | } 22 | 23 | void Mylabel::mousePressEvent(QMouseEvent* event) 24 | { 25 | if(event->button() == Qt::LeftButton) 26 | emit clicked(); 27 | } 28 | 29 | void Mylabel::SetName(QString na){ 30 | name = new QLabel(this); 31 | name->setText(na); 32 | name->setStyleSheet("background: rgba(0,0,0,.375);font-family: 黑体;text-align: center;color: white;border-width:0;font-weight: 600;font-size: 20px;"); 33 | name->setFixedHeight(this->height() / 3); 34 | name->setFixedWidth(this->width()); 35 | name->move(0,this->height() / 3 * 2); 36 | } 37 | 38 | void Mylabel::SetPage(QString page){ 39 | pic_page = new QToolButton(this); 40 | pic_page->setText(page); 41 | pic_page->setFixedWidth(40); 42 | pic_page->setFixedHeight(30); 43 | pic_page->setAttribute(Qt::WA_TranslucentBackground,true); 44 | pic_page->setStyleSheet("border-radius: 9px;background: rgba(0,0,0,.375);font-family: 黑体;text-align: center;color: white;border-width:0;font-weight: 600;font-size: 20px;"); 45 | pic_page->move(this->width() - pic_page->width() - 5,5); 46 | pic_page->setEnabled(false); 47 | } 48 | 49 | void Mylabel::Seteffect(){ 50 | QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect; 51 | effect->setOffset(4, 4); 52 | effect->setColor(QColor(0, 0, 0, 50)); 53 | effect->setBlurRadius(10); 54 | this->setGraphicsEffect(effect); 55 | } 56 | -------------------------------------------------------------------------------- /Pixiv1.5/mylabel.h: -------------------------------------------------------------------------------- 1 | #ifndef MYLABEL_H 2 | #define MYLABEL_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include"QMessageBox" 8 | #include 9 | #include 10 | class Mylabel: public QLabel 11 | { 12 | Q_OBJECT 13 | public: 14 | Mylabel(QWidget *parent=0); 15 | ~Mylabel(); 16 | void SetName(QString); 17 | void SetPage(QString); 18 | void Seteffect(); 19 | signals: 20 | void clicked(); 21 | 22 | protected: 23 | //void enterEvent(QEvent *); 24 | //void leaveEvent(QEvent *); 25 | void mousePressEvent(QMouseEvent* event); 26 | 27 | private: 28 | QLabel *name; 29 | QToolButton *pic_page; 30 | }; 31 | 32 | #endif // MYLABEL_H 33 | -------------------------------------------------------------------------------- /Pixiv1.5/pixiv.cpp: -------------------------------------------------------------------------------- 1 | #include "pixiv.h" 2 | #include "ui_pixiv.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "mylabel.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | #define FIRST_HOST "210.140.92.138" 16 | #define Message(A,B) QMessageBox::information(NULL, A,B ,QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) 17 | 18 | 19 | /*全局变量*/ 20 | SOFTWARE_VERSION VERSION = "1.5"; 21 | ImgInfo *m_imgs = new ImgInfo;//图片信息 22 | std::vectorm_Articlelabel;//上一次显示的作家label指针 23 | Mylabel* m_AHead;//画师头像 24 | Setting *m_set = new Setting;//设置信息 25 | PicContent *Art_PicContent = new PicContent; 26 | PicContent *Rank_PicContent = new PicContent; 27 | PicContent *Tag_PicContent = new PicContent; 28 | /*全局变量*/ 29 | 30 | Pixiv::Pixiv(QWidget *parent) 31 | : QMainWindow(parent) 32 | , ui(new Ui::Pixiv) 33 | { 34 | ui->setupUi(this); 35 | ui->scrollArea->setFrameShape(QFrame::NoFrame); 36 | ui->scrollArea_2->setFrameShape(QFrame::NoFrame); 37 | ui->scrollArea_3->setFrameShape(QFrame::NoFrame); 38 | ui->scrollArea_4->setFrameShape(QFrame::NoFrame); 39 | ui->scrollArea_5->setFrameShape(QFrame::NoFrame); 40 | //设置https 41 | request = new QNetworkRequest; 42 | m_accessManager = new QNetworkAccessManager(); 43 | 44 | QSslConfiguration config; 45 | QSslConfiguration conf = request->sslConfiguration(); 46 | conf.setPeerVerifyMode(QSslSocket::VerifyNone); 47 | conf.setProtocol(QSsl::TlsV1SslV3); 48 | request->setSslConfiguration(conf); 49 | connect(m_accessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(finishedSlot(QNetworkReply*))); 50 | //判断最新版本 51 | QNetworkAccessManager manager; 52 | QEventLoop loop; 53 | request->setUrl(QUrl("https://gitee.com/ailou/pixiv/raw/master/version.txt")); 54 | QNetworkReply *reply = manager.get(*request); 55 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 56 | loop.exec(); 57 | QByteArray content = reply->readAll(); 58 | 59 | QString version(content); 60 | if (version != VERSION) 61 | { 62 | if (QMessageBox::Yes == Message("提示","网络未连接或者已有新版本,请前往https://ealodi.xyz查看。")) 63 | { 64 | QDesktopServices::openUrl(QString("https://ealodi.xyz")); 65 | } 66 | } 67 | //读取设置内容 68 | ReadSetting(); 69 | ui->lineEdit_2->setText(m_set->path); 70 | ui->checkBox->setChecked(m_set->R18); 71 | ui->checkBox_2->setChecked(m_set->rankAuto); 72 | ui->comboBox_2->setCurrentIndex(m_set->PicQuality); 73 | //连接信号 74 | connect(this,SIGNAL(StartSearchPic(QString)),this,SLOT(PicClicked(QString))); 75 | connect(this,SIGNAL(StartSearchArt(QString)),this,SLOT(ArticleClicked(QString))); 76 | connect(this,SIGNAL(StartSearchRank(QString,QString)),this,SLOT(rank(QString,QString))); 77 | connect(this,SIGNAL(StartSearchTag(QString)),this,SLOT(TagSearch(QString))); 78 | //加载最近排行榜 79 | if (m_set->rankAuto){ 80 | QDateTime begin_time = QDateTime::currentDateTime(); 81 | QString date = begin_time.addDays(-2).toString("yyyy-MM-dd"); 82 | QDate current_date =QDate::currentDate(); 83 | ui->dateEdit->setDate(current_date.addDays(-2)); 84 | emit StartSearchRank("day",date); 85 | } 86 | } 87 | 88 | Pixiv::~Pixiv() 89 | { 90 | delete ui; 91 | delete request; 92 | delete m_accessManager; 93 | } 94 | //接收函数 95 | void Pixiv::finishedSlot(QNetworkReply *reply) 96 | { 97 | 98 | if (reply->error() == QNetworkReply::NoError) 99 | { 100 | QByteArray bytes = reply->readAll(); 101 | emit Requestover(bytes); 102 | } 103 | else 104 | { 105 | qDebug()<<"handle errors here"; 106 | QVariant statusCodeV = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); 107 | //statusCodeV是HTTP服务器的相应码,reply->error()是Qt定义的错误码,可以参考QT的文档 108 | qDebug() << reply->error(); 109 | Message("Request Error: ",QString::number(statusCodeV.toInt())+" " + QString::number((int)reply->error())); 110 | print("Request Error: " + QString::number(statusCodeV.toInt())+" " + QString::number((int)reply->error())); 111 | } 112 | reply->deleteLater(); 113 | } 114 | 115 | void Pixiv::on_toolButton_clicked() 116 | { 117 | int choice = ui->comboBox->currentIndex(); 118 | switch (choice) { 119 | case 0:emit StartSearchPic(ui->lineEdit->text());break; 120 | case 1:emit StartSearchArt(ui->lineEdit->text());break; 121 | case 2: 122 | emit StartSearchTag(ui->lineEdit->text()); 123 | break; 124 | } 125 | 126 | } 127 | 128 | void Pixiv::DealSearchContent(QByteArray& content){ 129 | cleanLast(ui->scrollAreaWidgetContents); 130 | m_imgs->clear(); 131 | QJsonDocument doc = QJsonDocument::fromJson(content); 132 | QJsonObject obj = doc.object().value("illust").toObject(); 133 | 134 | m_imgs->SetPicID(obj.value("id").toInt()); 135 | m_imgs->SetStatus_code(200); 136 | m_imgs->SetPage_count(obj.value("page_count").toInt()); 137 | m_imgs->SetUserID(obj.value("user").toObject().value("id").toInt()); 138 | m_imgs->SetPicName(obj.value("title").toString()); 139 | m_imgs->SetUserName(obj.value("user").toObject().value("name").toString()); 140 | 141 | ui->pname->setText(m_imgs->GetPicName()); 142 | ui->pname->setCursorPosition(0); 143 | ui->pid->setText(QString::number(m_imgs->GetPicID())); 144 | ui->aname->setText(m_imgs->GetUserName()); 145 | ui->aname->setCursorPosition(0); 146 | ui->aid->setText(QString::number(m_imgs->GetUserID())); 147 | ui->page->setText(QString::number(m_imgs->GetPage_count())); 148 | 149 | QString quality = m_set->GetPicQuality(); 150 | 151 | if (m_imgs->GetPage_count() == 1){ 152 | m_imgs->PushAUrlToMedium(ChanHost(obj.value("image_urls").toObject().value(quality).toString(),FIRST_HOST)); 153 | m_imgs->PushAUrlToOrigin(ChanHost(obj.value("meta_single_page").toObject().value("original_image_url").toString(),FIRST_HOST)); 154 | } 155 | else { 156 | QJsonArray array = obj.value("meta_pages").toArray(); 157 | for (int i = 0;i < array.size();i++){ 158 | m_imgs->PushAUrlToMedium(ChanHost(array.at(i).toObject().value("image_urls").toObject().value(quality).toString(),FIRST_HOST)); 159 | m_imgs->PushAUrlToOrigin(ChanHost(array.at(i).toObject().value("image_urls").toObject().value("original").toString(),FIRST_HOST)); 160 | } 161 | } 162 | 163 | QNetworkAccessManager manager; 164 | QEventLoop loop; 165 | ui->scrollAreaWidgetContents->setMinimumHeight(250); 166 | 167 | for (int i = 0;i < (int)m_imgs->GetPage_count();i++){ 168 | request->setUrl(QUrl(m_imgs->square_medium[i])); 169 | request->setRawHeader("referer","https://www.pixiv.net"); 170 | QNetworkReply *reply = manager.get(*request); 171 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 172 | //开启子事件循环 173 | loop.exec(); 174 | QByteArray Pic = reply->readAll(); 175 | 176 | QImage img; 177 | img.loadFromData(Pic); 178 | int y = GetLargestY(ui->scrollAreaWidgetContents); 179 | Mylabel *label = new Mylabel(ui->scrollAreaWidgetContents); 180 | 181 | int width = img.width(),height = img.height(); 182 | double times = 1; 183 | while(width > 450 || height > 400){ 184 | times += 0.1; 185 | width = img.width() / times; 186 | height = img.height() / times; 187 | } 188 | label->setFixedHeight(height); 189 | label->setFixedWidth(width); 190 | label->setScaledContents(true); 191 | label->move(491 / 2 - width / 2,y + 10); 192 | ui->scrollAreaWidgetContents->setMinimumHeight(GetLargestY(ui->scrollAreaWidgetContents) + 50); 193 | label->setPixmap(Radius(img,15)); 194 | label->setStyleSheet("border: 2px solid #808080;border-radius: 15px;"); 195 | label->show(); 196 | print("显示图片成功!"); 197 | reply->deleteLater(); 198 | } 199 | } 200 | 201 | void Pixiv::print(QString info){ 202 | ui->textEdit->append(GetTime() + ": " + info); 203 | //qDebug() << GetTime() + ": " << info; 204 | } 205 | 206 | QString ChanHost(QString url,QString hosts) 207 | { 208 | int s = url.indexOf("://",0,Qt::CaseInsensitive) + 3; 209 | int e = url.indexOf("/",s,Qt::CaseInsensitive); 210 | QString host = url.mid(s,e - s); 211 | return url.replace(host,hosts); 212 | } 213 | //查找随机图 214 | void Pixiv::on_toolButton_2_clicked() 215 | { 216 | //准备 217 | print("查找随机插画。"); 218 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//清空Requestover的所有槽 219 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealRadomPic(QByteArray&))); 220 | //开始 221 | QString r18 = ""; 222 | if (m_set->R18)r18 = "&r18=true"; 223 | 224 | QString url = "https://api.loli.st/pixiv/random.php?type=json" + r18; 225 | request->setUrl(QUrl(url)); 226 | request->setRawHeader("user-agent", 227 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 228 | m_accessManager->get(*request); 229 | } 230 | //随机图片处理 231 | void Pixiv::DealRadomPic(QByteArray& content){ 232 | print("正常处理随机插画!"); 233 | QJsonObject doc = QJsonDocument::fromJson(content).object(); 234 | QString id = doc.value("illust_id").toString(); 235 | emit StartSearchPic(id); 236 | } 237 | //下载 238 | void Pixiv::on_toolButton_3_clicked() 239 | { 240 | print("开始下载图片数据!"); 241 | ui->progressBar_2->setMinimum(0); 242 | ui->progressBar_2->setMaximum(m_imgs->GetPage_count() * 1000); 243 | ui->progressBar_2->setValue(0); 244 | std::vectorlasts(m_imgs->GetPage_count(),0); 245 | for (int i = 0;i < int(m_imgs->GetPage_count());i++){ 246 | QNetworkAccessManager *manager = new QNetworkAccessManager; 247 | 248 | connect(manager, &QNetworkAccessManager::finished, [=](QNetworkReply* reply)mutable{ 249 | QByteArray bytes = reply->readAll(); 250 | int last = m_imgs->original[i].lastIndexOf("/"); 251 | QString name = m_imgs->original[i].mid(last); 252 | QFile file; 253 | file.setFileName(m_set->path + name); 254 | file.open(QIODevice::WriteOnly); 255 | file.write(bytes); 256 | file.close(); 257 | ui->progressBar_2->setValue(m_imgs->GetPage_count() * 1000); 258 | print("下载完成! " + name); 259 | reply->deleteLater(); 260 | }); 261 | //发出请求 262 | request->setUrl(QUrl(m_imgs->original[i])); 263 | request->setRawHeader("referer","https://www.pixiv.net"); 264 | QNetworkReply* reply = manager->get(*request); 265 | connect(reply, &QNetworkReply::downloadProgress, [=](qint64 now,qint64 all)mutable{ 266 | double a = now,b = all; 267 | ui->progressBar_2->setValue(ui->progressBar_2->value() + (double)((a-lasts[i]) / b) * 1000); 268 | lasts[i] = now; 269 | }); 270 | } 271 | } 272 | //读取设置 273 | void ReadSetting(){ 274 | QFile file; 275 | file.setFileName("./pix_config.json"); 276 | if (file.open(QIODevice::ReadOnly)) 277 | { 278 | QByteArray content = file.readAll(); 279 | QJsonDocument doc = QJsonDocument::fromJson(content); 280 | QJsonObject obj = doc.object(); 281 | m_set->path = obj.value("path").toString(); 282 | m_set->R18 = obj.value("R18").toBool(); 283 | m_set->PicQuality = obj.value("PicQuality").toInt(); 284 | m_set->rankAuto = obj.value("rankAuto").toBool(); 285 | 286 | } 287 | else { 288 | file.close(); 289 | file.open(QIODevice::WriteOnly); 290 | QJsonObject obj; 291 | obj.insert("path",m_set->path); 292 | obj.insert("R18",m_set->R18); 293 | obj.insert("rankAuto",m_set->rankAuto); 294 | obj.insert("PicQuality",m_set->PicQuality); 295 | QJsonDocument document=QJsonDocument(obj); 296 | QByteArray array = document.toJson(); 297 | file.write(array); 298 | } 299 | file.close(); 300 | } 301 | //保存设置 302 | void Pixiv::on_toolButton_4_clicked() 303 | { 304 | QFile file("./pix_config.json"); 305 | file.open(QIODevice::WriteOnly); 306 | QJsonObject obj; 307 | obj.insert("path",ui->lineEdit_2->text()); 308 | obj.insert("R18",ui->checkBox->isChecked()); 309 | obj.insert("rankAuto",ui->checkBox_2->isChecked()); 310 | obj.insert("PicQuality",ui->comboBox_2->currentIndex()); 311 | m_set->path = ui->lineEdit_2->text(); 312 | m_set->R18 = ui->checkBox->isChecked(); 313 | m_set->PicQuality = ui->comboBox_2->currentIndex(); 314 | m_set->rankAuto = ui->checkBox_2->isChecked(); 315 | QJsonDocument document=QJsonDocument(obj); 316 | QByteArray array = document.toJson(); 317 | file.write(array); 318 | file.close(); 319 | 320 | print("保存设置成功!"); 321 | 322 | Message("提示","保存成功!"); 323 | 324 | } 325 | //浏览文件夹 326 | void Pixiv::on_liulan_clicked() 327 | { 328 | QString paths = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, "选择保存路径", QDir::currentPath())); 329 | ui->lineEdit_2->setText(paths); 330 | } 331 | //画师 332 | void Pixiv::ArticleClicked(QString id){ 333 | print("开始查找画师:" + ui->lineEdit->text() + "。"); 334 | //准备 335 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//清空Requestover的所有槽 336 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealAritcleContent(QByteArray&))); 337 | //开始 338 | QString url = "https://pixiviz.pwp.app/api/v1/user/detail?id=" + id;; 339 | request->setUrl(QUrl(url)); 340 | request->setRawHeader("Referer","https://pixiviz.pwp.app/artist/" + id.toUtf8()); 341 | request->setRawHeader("user-agent", 342 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 343 | m_accessManager->get(*request); 344 | } 345 | //处理画师信息 346 | void Pixiv::DealAritcleContent(QByteArray& content){ 347 | cleanLast(ui->scrollAreaWidgetContents_3); 348 | 349 | ui->scrollAreaWidgetContents_3->setMinimumHeight(ui->scrollArea_3->height()); 350 | Art_PicContent->clear(); 351 | 352 | connect(ui->scrollArea_3->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_3_Bar_Down); 353 | QJsonDocument doc = QJsonDocument::fromJson(content); 354 | QJsonObject obj = doc.object(); 355 | QString id = QString::number(obj.value("user").toObject().value("id").toInt()); 356 | QString name = obj.value("user").toObject().value("name").toString(); 357 | QString headUrl = ChanHost(obj.value("user").toObject().value("profile_image_urls").toObject().value("medium").toString(),FIRST_HOST); 358 | QString comment = obj.value("user").toObject().value("comment").toString(); 359 | int PicNum = obj.value("profile").toObject().value("total_illusts").toInt(); 360 | int MangaNum = obj.value("profile").toObject().value("total_manga").toInt(); 361 | int novelsNum = obj.value("profile").toObject().value("total_novels").toInt(); 362 | 363 | for (int i = 0;i < 8;i++){ 364 | Mylabel *label = new Mylabel(ui->scrollAreaWidgetContents_3); 365 | m_Articlelabel.push_back(label); 366 | } 367 | //画师名称 368 | m_Articlelabel[0]->setText(name); 369 | m_Articlelabel[0]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 370 | m_Articlelabel[0]->adjustSize(); 371 | m_Articlelabel[0]->move(491 / 2 - m_Articlelabel[0]->width() / 2,220); 372 | m_Articlelabel[0]->show(); 373 | 374 | int y1 = m_Articlelabel[0]->pos().y() + m_Articlelabel[0]->height() + 20; 375 | m_Articlelabel[2]->setText("漫画"); 376 | m_Articlelabel[2]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 377 | m_Articlelabel[2]->adjustSize(); 378 | m_Articlelabel[2]->move(m_Articlelabel[0]->pos().x() + m_Articlelabel[0]->width() / 2 - m_Articlelabel[2]->width() / 2,y1); 379 | m_Articlelabel[2]->show(); 380 | 381 | m_Articlelabel[1]->setText("插画"); 382 | m_Articlelabel[1]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 383 | m_Articlelabel[1]->adjustSize(); 384 | m_Articlelabel[1]->move(m_Articlelabel[2]->pos().x() - 40 - m_Articlelabel[2]->width() / 2,y1); 385 | m_Articlelabel[1]->show(); 386 | 387 | m_Articlelabel[3]->setText("小说"); 388 | m_Articlelabel[3]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 389 | m_Articlelabel[3]->adjustSize(); 390 | m_Articlelabel[3]->move(m_Articlelabel[2]->pos().x() + m_Articlelabel[2]->width() / 2 + 40,y1); 391 | m_Articlelabel[3]->show(); 392 | 393 | 394 | int y2 = m_Articlelabel[1]->pos().y() + m_Articlelabel[1]->height(); 395 | m_Articlelabel[4]->setText(QString::number(PicNum)); 396 | m_Articlelabel[4]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 397 | m_Articlelabel[4]->adjustSize(); 398 | m_Articlelabel[4]->move(m_Articlelabel[1]->pos().x() + m_Articlelabel[1]->width() / 2 - m_Articlelabel[4]->width() / 2,y2); 399 | m_Articlelabel[4]->show(); 400 | 401 | m_Articlelabel[5]->setText(QString::number(MangaNum)); 402 | m_Articlelabel[5]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 403 | m_Articlelabel[5]->adjustSize(); 404 | m_Articlelabel[5]->move(m_Articlelabel[2]->pos().x() + m_Articlelabel[2]->width() / 2 - m_Articlelabel[5]->width() / 2,y2); 405 | m_Articlelabel[5]->show(); 406 | 407 | m_Articlelabel[6]->setText(QString::number(novelsNum)); 408 | m_Articlelabel[6]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 409 | m_Articlelabel[6]->adjustSize(); 410 | m_Articlelabel[6]->move(m_Articlelabel[3]->pos().x() + m_Articlelabel[3]->width() / 2 - m_Articlelabel[6]->width() / 2,y2); 411 | m_Articlelabel[6]->show(); 412 | 413 | m_Articlelabel[7]->setText(comment); 414 | m_Articlelabel[7]->setStyleSheet("font-family: 黑体;font-size: 14px;font-weight: 400;color: #da7a85;line-height: 24px;"); 415 | m_Articlelabel[7]->adjustSize(); 416 | m_Articlelabel[7]->move(491 / 2 - m_Articlelabel[7]->width() / 2,m_Articlelabel[6]->pos().y() + m_Articlelabel[6]->height() + 20); 417 | m_Articlelabel[7]->show(); 418 | ui->scrollAreaWidgetContents_3->setMinimumHeight(m_Articlelabel[7]->pos().y() + m_Articlelabel[7]->height() + 20); 419 | if (ui->scrollAreaWidgetContents_3->height() <= ui->scrollArea_3->height()){ 420 | ui->scrollAreaWidgetContents_3->setMinimumHeight(ui->scrollArea_3->height() + 10); 421 | } 422 | QNetworkAccessManager *manager = new QNetworkAccessManager; 423 | //发出请求 424 | request->setUrl(QUrl(headUrl)); 425 | print("载入画师头像。"); 426 | request->setRawHeader("referer","https://www.pixiv.net"); 427 | manager->get(*request); 428 | connect(manager,&QNetworkAccessManager::finished,[=](QNetworkReply *reply){ 429 | 430 | QByteArray contents = reply->readAll(); 431 | print("画师头像大小: " + QString::number(contents.size())); 432 | 433 | QImage toux; 434 | toux.loadFromData(contents); 435 | int width = toux.width(),height = toux.height(); 436 | double times = 1; 437 | while(width > 200 || height > 200){ 438 | times += 0.1; 439 | width = toux.width() / times; 440 | height = toux.height() / times; 441 | } 442 | delete m_AHead; 443 | m_AHead = NULL; 444 | 445 | m_AHead = new Mylabel(ui->scrollAreaWidgetContents_3); 446 | m_AHead->setFixedHeight(height); 447 | m_AHead->setFixedWidth(width); 448 | 449 | QPixmap pixmap(width,height);//准备装图片的矩形框 450 | pixmap.fill(Qt::transparent); 451 | QPainter painter(&pixmap); 452 | painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); 453 | QPainterPath path; 454 | path.addRoundedRect(0,0,width, height,width/2,width/2); 455 | painter.setClipPath(path); 456 | painter.drawPixmap(0, 0, width, height, QPixmap::fromImage(toux));//将显示图片的pixmap画入矩形框内 457 | 458 | 459 | m_AHead->setPixmap(pixmap); 460 | m_AHead->setScaledContents(true); 461 | m_AHead->move(491 / 2 - width / 2,20); 462 | m_AHead->show(); 463 | print("载入画师头像完成!"); 464 | 465 | reply->deleteLater(); 466 | }); 467 | 468 | int page = 1; 469 | while(page < PicNum / 30 + 2){ 470 | QNetworkAccessManager *manager_3 = new QNetworkAccessManager; 471 | QString url = "https://pixiviz.pwp.app/api/v1/user/illusts?id=" + id + "&page=" + QString::number(page); 472 | request->setUrl(QUrl(url)); 473 | request->setRawHeader("Referer","https://pixiviz.pwp.app/artist/" + id.toUtf8()); 474 | request->setRawHeader("user-agent", 475 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 476 | connect(manager_3,&QNetworkAccessManager::finished,[=](QNetworkReply *reply)mutable{ 477 | QByteArray contents = reply->readAll(); 478 | QJsonDocument doc = QJsonDocument::fromJson(contents); 479 | QJsonObject obj = doc.object(); 480 | 481 | QJsonArray AtPics = obj.value("illusts").toArray(); 482 | qDebug() << AtPics.size(); 483 | if (AtPics.size() == 0){ 484 | //disconnect(ui->scrollArea_3->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_3_Bar_Down); 485 | return; 486 | } 487 | QString quality = m_set->GetPicQuality(); 488 | 489 | for (int i = 0;i < AtPics.size();i++){ 490 | QString url = ChanHost(AtPics.at(i).toObject().value("image_urls").toObject().value(quality).toString(),FIRST_HOST); 491 | request->setUrl(QUrl(url)); 492 | QNetworkAccessManager *manager_2 = new QNetworkAccessManager; 493 | request->setRawHeader("Referer","https://www.pixiv.net"); 494 | manager_2->get(*request); 495 | 496 | connect(manager_2, &QNetworkAccessManager::finished, [=](QNetworkReply *replys){ 497 | QByteArray content = replys->readAll(); 498 | QImage image; 499 | image.loadFromData(content); 500 | QPixmap b = Radius(image,15); 501 | DisPlay_PicContent img; 502 | img.image = b.toImage(); 503 | img.title = AtPics.at(i).toObject().value("title").toString(); 504 | img.page_count = QString::number(AtPics.at(i).toObject().value("page_count").toInt()); 505 | QJsonObject newobj; 506 | newobj.insert("illust",AtPics.at(i).toObject()); 507 | QByteArray byte = QJsonDocument(newobj).toJson(QJsonDocument::Compact); 508 | 509 | img.content = byte; 510 | Art_PicContent->push_back(img); 511 | replys->deleteLater(); 512 | }); 513 | } 514 | reply->deleteLater(); 515 | }); 516 | manager_3->get(*request); 517 | page++; 518 | } 519 | 520 | } 521 | //插画爬取 522 | void Pixiv::PicClicked(QString id){ 523 | //准备 524 | 525 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//情况Requestover的所有槽 526 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealSearchContent(QByteArray&))); 527 | 528 | //开始 529 | print("开始获取插画。"); 530 | QString url = "https://pixiviz.pwp.app/api/v1/illust/detail?id=" + id; 531 | request->setUrl(QUrl(url)); 532 | request->setRawHeader("Referer","https://pixiviz.pwp.app/"); 533 | request->setRawHeader("user-agent", 534 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 535 | m_accessManager->get(*request); 536 | } 537 | //获取当前时间 538 | QString GetTime(){ 539 | QDateTime current_date_time = QDateTime::currentDateTime(); 540 | QString current_date = current_date_time.toString("hh:mm:ss"); 541 | return current_date; 542 | } 543 | 544 | void Pixiv::on_textEdit_textChanged() 545 | { 546 | ui->textEdit->moveCursor(QTextCursor::End); 547 | } 548 | //排行榜时间被选择 549 | void Pixiv::on_pushButton_2_clicked() 550 | { 551 | QString date = ui->dateEdit->text(); 552 | for(int i = 0;i < date.size();i++){ 553 | if (date.at(i) == "-" && i == date.size() - 2) 554 | { 555 | date.remove(i,1); 556 | date.insert(i,"-0"); 557 | break; 558 | } 559 | if (date.at(i) == "-" && date.at(i + 2) == "-"){ 560 | date.remove(i,1); 561 | date.insert(i,"-0"); 562 | } 563 | } 564 | int choice = ui->comboBox_3->currentIndex(); 565 | QString mode = ""; 566 | switch (choice) { 567 | case 0: 568 | mode = "day"; 569 | break; 570 | case 1: 571 | mode = "week"; 572 | break; 573 | case 2: 574 | mode = "month"; 575 | break; 576 | default: 577 | break; 578 | } 579 | emit StartSearchRank(mode,date); 580 | } 581 | //排行榜获取 582 | void Pixiv::rank(QString mode,QString time){ 583 | cleanLast(ui->scrollAreaWidgetContents_4); 584 | ui->scrollAreaWidgetContents_4->setMinimumHeight(ui->scrollArea_4->height() + 10); 585 | connect(ui->scrollArea_4->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_4_Bar_Down); 586 | int page = 1; 587 | while(page <= 3){ 588 | QString url = "https://pixiviz.pwp.app/api/v1/illust/rank?mode=" + mode + "&date=" + time + "&page=" + QString::number(page); 589 | QNetworkAccessManager *manager = new QNetworkAccessManager; 590 | connect(manager,&QNetworkAccessManager::finished,[=](QNetworkReply *reply)mutable{ 591 | QByteArray content = reply->readAll(); 592 | QJsonDocument doc = QJsonDocument::fromJson(content); 593 | QJsonObject obj = doc.object(); 594 | 595 | QJsonArray AtPics = obj.value("illusts").toArray(); 596 | if (AtPics.size() == 0){ 597 | //disconnect(ui->scrollArea_3->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_3_Bar_Down); 598 | return; 599 | } 600 | QString quality = m_set->GetPicQuality(); 601 | for (int i = 0;i < AtPics.size();i++){ 602 | QNetworkAccessManager *manager_2 = new QNetworkAccessManager; 603 | QString url = ChanHost(AtPics.at(i).toObject().value("image_urls").toObject().value(quality).toString(),FIRST_HOST); 604 | request->setUrl(QUrl(ChanHost(url,FIRST_HOST))); 605 | request->setRawHeader("referer","https://www.pixiv.net"); 606 | connect(manager_2, &QNetworkAccessManager::finished, [=](QNetworkReply *replys){ 607 | QByteArray content = replys->readAll(); 608 | QImage image; 609 | image.loadFromData(content); 610 | DisPlay_PicContent img; 611 | img.image = Radius(image,15).toImage(); 612 | img.title = AtPics.at(i).toObject().value("title").toString(); 613 | img.page_count = QString::number(AtPics.at(i).toObject().value("page_count").toInt()); 614 | QJsonObject newobj; 615 | newobj.insert("illust",AtPics.at(i).toObject()); 616 | QByteArray byte = QJsonDocument(newobj).toJson(QJsonDocument::Compact); 617 | img.content = byte; 618 | Rank_PicContent->push_back(img); 619 | replys->deleteLater(); 620 | }); 621 | manager_2->get(*request); 622 | } 623 | reply->deleteLater(); 624 | }); 625 | request->setUrl(QUrl(url)); 626 | request->setRawHeader("Referer","https://pixiviz.pwp.app"); 627 | request->setRawHeader("user-agent", 628 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 629 | manager->get(*request); 630 | page++; 631 | } 632 | } 633 | 634 | QPixmap Pixiv::Radius(QImage &pic,int radius){ 635 | int width = pic.width(); 636 | int height = pic.height(); 637 | 638 | QPixmap pixmap(width,height); 639 | pixmap.fill(Qt::transparent); 640 | QPainter painter(&pixmap); 641 | painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); 642 | QPainterPath path; 643 | path.addRoundedRect(0,0,width, height,radius,radius); 644 | painter.setClipPath(path); 645 | painter.drawPixmap(0, 0, width, height, QPixmap::fromImage(pic));//将显示图片的pixmap画入矩形框内 646 | return pixmap; 647 | } 648 | 649 | void Pixiv::TagSearch(QString word) 650 | { 651 | cleanLast(ui->scrollAreaWidgetContents_5); 652 | ui->scrollAreaWidgetContents_5->setMinimumHeight(ui->scrollArea_5->height() + 10); 653 | connect(ui->scrollArea_5->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_5_Bar_Down); 654 | int page = 1; 655 | while (page <= 3) 656 | { 657 | QTextCodec *utf8 = QTextCodec::codecForName("utf-8"); 658 | QByteArray encoded = utf8->fromUnicode(QString::fromUtf8(word.toUtf8())).toPercentEncoding(); 659 | QString base_url = "https://pixiviz.pwp.app/api/v1/illust/search?word=" + QString(encoded); 660 | QString url = base_url + "&page=" + QString::number(page); 661 | QNetworkAccessManager *manager = new QNetworkAccessManager; 662 | connect(manager,&QNetworkAccessManager::finished,[=](QNetworkReply* reply)mutable{ 663 | QByteArray content = reply->readAll(); 664 | QJsonDocument doc = QJsonDocument::fromJson(content); 665 | QJsonObject obj = doc.object(); 666 | 667 | QJsonArray AtPics = obj.value("illusts").toArray(); 668 | if (AtPics.size() == 0){ 669 | return; 670 | } 671 | for (int i = 0;i < AtPics.size();i++){ 672 | QNetworkAccessManager *manager_2 = new QNetworkAccessManager; 673 | QString url = ChanHost(AtPics.at(i).toObject().value("image_urls").toObject().value("medium").toString(),FIRST_HOST); 674 | request->setUrl(QUrl(ChanHost(url,FIRST_HOST))); 675 | request->setRawHeader("referer","https://www.pixiv.net"); 676 | manager_2->get(*request); 677 | connect(manager_2, &QNetworkAccessManager::finished, [=](QNetworkReply *replys){ 678 | QByteArray content = replys->readAll(); 679 | QImage image; 680 | image.loadFromData(content); 681 | DisPlay_PicContent img; 682 | img.image = Radius(image,15).toImage(); 683 | img.title = AtPics.at(i).toObject().value("title").toString(); 684 | img.page_count = QString::number(AtPics.at(i).toObject().value("page_count").toInt()); 685 | QJsonObject newobj; 686 | newobj.insert("illust",AtPics.at(i).toObject()); 687 | QByteArray byte = QJsonDocument(newobj).toJson(QJsonDocument::Compact); 688 | img.content = byte; 689 | Tag_PicContent->push_back(img); 690 | replys->deleteLater(); 691 | }); 692 | } 693 | reply->deleteLater(); 694 | }); 695 | //发出请求 696 | request->setUrl(QUrl(url)); 697 | request->setRawHeader("Referer","https://pixiviz.pwp.app/search/" + encoded); 698 | manager->get(*request); 699 | page++; 700 | } 701 | } 702 | 703 | QString Setting::GetPicQuality(){ 704 | 705 | QString quality = ""; 706 | switch (PicQuality) { 707 | case 0: 708 | quality = "square_medium"; 709 | break; 710 | case 1: 711 | quality = "medium"; 712 | break; 713 | case 2: 714 | quality = "large"; 715 | break; 716 | } 717 | return quality; 718 | } 719 | //画师下一张滚动插画 720 | void Pixiv::Scroll_3_Bar_Down(int yUp){ 721 | PutPicInScroll(Art_PicContent,ui->scrollAreaWidgetContents_3,491,450,400,yUp); 722 | } 723 | //排行榜下一张滚动插画 724 | void Pixiv::Scroll_4_Bar_Down(int yUp){ 725 | PutPicInScroll(Rank_PicContent,ui->scrollAreaWidgetContents_4,491,450,400,yUp); 726 | } 727 | //tag下一张滚动插画 728 | void Pixiv::Scroll_5_Bar_Down(int yUp){ 729 | PutPicInScroll(Tag_PicContent,ui->scrollAreaWidgetContents_5,491,450,400,yUp); 730 | } 731 | 732 | int Pixiv::GetLargestY(QWidget *scrollContent){ 733 | QObjectList children = scrollContent->children(); 734 | int Large = 0; 735 | for (int i = 0;i < children.size();i++){ 736 | int y = qobject_cast(children.at(i))->pos().y() + qobject_cast(children.at(i))->height(); 737 | Large = y > Large ? y : Large; 738 | } 739 | return Large; 740 | } 741 | 742 | void Pixiv::PutPicInScroll(PicContent*picContent,QWidget*scrollContent,int x,int _width,int _height,int yUp){ 743 | if (picContent->size() == 0)return; 744 | QWidget *area = qobject_cast(scrollContent->parent()); 745 | if (yUp + area->height() == scrollContent->height()){ 746 | int y = GetLargestY(scrollContent) + 10; 747 | if (picContent->begin() != picContent->end()){ 748 | QImage image = picContent->begin()->image; 749 | Mylabel* label = new Mylabel(scrollContent); 750 | QByteArray content = picContent->begin()->content; 751 | connect(label,&Mylabel::clicked,[=](){ 752 | ui->tabWidget->setCurrentIndex(1); 753 | QByteArray contents = content; 754 | qDebug() << contents.size(); 755 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//清空Requestover的所有槽 756 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealSearchContent(QByteArray&))); 757 | 758 | emit Requestover(contents); 759 | 760 | }); 761 | int width = image.width(),height = image.height(); 762 | double times = 1; 763 | while(width > _width || height > _height){ 764 | times += 0.1; 765 | width = image.width() / times; 766 | height = image.height() / times; 767 | } 768 | label->setFixedWidth(width); 769 | label->setFixedHeight(height); 770 | label->SetName(picContent->begin()->title); 771 | label->SetPage(picContent->begin()->page_count); 772 | label->Seteffect(); 773 | label->setCursor(Qt::PointingHandCursor); 774 | label->setStyleSheet("border: 2px solid #808080;border-radius: 15px;"); 775 | label->setPixmap(QPixmap::fromImage(image)); 776 | label->setScaledContents(true); 777 | if (y >= area->height() - 10) 778 | scrollContent->setMinimumHeight(y + label->height() + 30); 779 | label->move(x / 2 - width / 2,y); 780 | label->show(); 781 | 782 | picContent->erase(picContent->begin()); 783 | } 784 | } 785 | } 786 | -------------------------------------------------------------------------------- /Pixiv1.5/pixiv.h: -------------------------------------------------------------------------------- 1 | #ifndef PIXIV_H 2 | #define PIXIV_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "mylabel.h" 9 | 10 | QT_BEGIN_NAMESPACE 11 | namespace Ui { class Pixiv; } 12 | QT_END_NAMESPACE 13 | struct DisPlay_PicContent{ 14 | 15 | QImage image; 16 | QString title = ""; 17 | QString page_count = "0"; 18 | QByteArray content = ""; 19 | }; 20 | typedef std::vector PicContent; 21 | typedef std::vectorDisplay; 22 | typedef const QString SOFTWARE_VERSION; 23 | 24 | class Pixiv : public QMainWindow 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | //处理label资源 30 | void inline static cleanLast(QWidget * scrollContent){ 31 | QListlabels = scrollContent->findChildren(); 32 | foreach (Mylabel* label, labels) { 33 | if (!label)continue; 34 | label->setParent(nullptr); 35 | delete label; 36 | } 37 | } 38 | int inline GetLargestY(QWidget *); 39 | void inline PutPicInScroll(PicContent*,QWidget*,int x,int width,int height,int yUp); 40 | QPixmap static Radius(QImage &pic,int radius); 41 | void print(QString info); 42 | QNetworkRequest *request; 43 | QNetworkAccessManager *m_accessManager; 44 | Pixiv(QWidget *parent = nullptr); 45 | ~Pixiv(); 46 | signals: 47 | void finished(QNetworkReply*);//发送接收信号 48 | void Requestover(QByteArray&); 49 | void DownOriginal(QString); 50 | void StartSearchPic(QString id);//开始爬取插画 51 | void StartSearchArt(QString id);//开始爬取画师 52 | void StartSearchRank(QString mode,QString time);//开始爬取排行榜 53 | void StartSearchTag(QString word);//开始爬取搜索内容 54 | private slots: 55 | void Scroll_5_Bar_Down(int yUp); 56 | void Scroll_3_Bar_Down(int yUp); 57 | void Scroll_4_Bar_Down(int yUp); 58 | void TagSearch(QString word);//搜索内容 59 | void rank(QString mode,QString time);//排行榜 60 | void finishedSlot(QNetworkReply* reply);//接收数据 61 | void DealSearchContent(QByteArray& content);//解析接收到的数据(插画) 62 | void DealAritcleContent(QByteArray& content);//解析接收到的数据(画师) 63 | void DealRadomPic(QByteArray& content);//处理随机图片 64 | void PicClicked(QString id);//爬取插画 65 | void ArticleClicked(QString id);//画师ID 66 | void on_toolButton_clicked(); 67 | void on_toolButton_2_clicked(); 68 | void on_toolButton_3_clicked(); 69 | void on_toolButton_4_clicked(); 70 | void on_liulan_clicked(); 71 | void on_textEdit_textChanged(); 72 | void on_pushButton_2_clicked(); 73 | 74 | private: 75 | Ui::Pixiv *ui; 76 | }; 77 | 78 | QString ChanHost(QString url,const QString hosts);//换HOST 79 | void ReadSetting();//读取设置 80 | QString GetTime();//获取当前时间 81 | 82 | 83 | class Setting{ 84 | public: 85 | QString GetPicQuality(); 86 | QString path = "./"; 87 | bool R18 = false; 88 | int PicQuality = 0; 89 | bool rankAuto = false; 90 | }; 91 | //图片类 92 | class ImgInfo{ 93 | private: 94 | unsigned int status_code = 0; 95 | unsigned int page_count = 0; 96 | unsigned long PicID = 0; 97 | unsigned long UserID = 0; 98 | QString UserName = "",PicName = ""; 99 | public: 100 | ImgInfo(){ 101 | status_code = 0;page_count = 0;PicID = 0;UserID = 0;QString UserName = ""; 102 | PicName = ""; 103 | } 104 | void clear(){ 105 | status_code = 0;page_count = 0;PicID = 0;UserID = 0;QString UserName = ""; 106 | PicName = ""; 107 | original.clear(); 108 | square_medium.clear(); 109 | } 110 | ImgInfo(unsigned status_code_, 111 | unsigned int page_count_, 112 | unsigned long PicID_, 113 | unsigned long UserID_, 114 | 115 | QString UserName_, 116 | QString PicName_ 117 | ){ 118 | status_code = status_code_; 119 | page_count = page_count_; 120 | PicID = PicID_; 121 | UserID = UserID_; 122 | 123 | UserName = UserName_; 124 | PicName = PicName_; 125 | } 126 | std::vectorsquare_medium; 127 | std::vectororiginal; 128 | void PushAUrlToMedium(QString url){ 129 | square_medium.push_back(url); 130 | } 131 | void PushAUrlToOrigin(QString url){ 132 | original.push_back(url); 133 | } 134 | unsigned int GetStatus_code() const{ 135 | return status_code; 136 | } 137 | unsigned int GetPage_count() const{ 138 | return page_count; 139 | } 140 | unsigned long GetPicID() const{ 141 | return PicID; 142 | } 143 | unsigned long GetUserID() const{ 144 | return UserID; 145 | } 146 | QString GetUserName() const{ 147 | return UserName; 148 | } 149 | QString GetPicName() const{ 150 | return PicName; 151 | } 152 | 153 | void SetStatus_code(unsigned status_code_){ 154 | status_code = status_code_; 155 | } 156 | void SetPage_count(unsigned Page_count_){ 157 | page_count = Page_count_; 158 | } 159 | void SetPicID(unsigned long PicID_){ 160 | PicID = PicID_; 161 | } 162 | void SetUserID(unsigned long UserID_){ 163 | UserID = UserID_; 164 | } 165 | void SetUserName(QString UserName_){ 166 | UserName = UserName_; 167 | } 168 | void SetPicName(QString PicName_){ 169 | PicName = PicName_; 170 | } 171 | }; 172 | 173 | #endif // PIXIV_H 174 | -------------------------------------------------------------------------------- /Pixiv1.5/pixiv.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pixiv 4 | 5 | 6 | 7 | 0 8 | 0 9 | 500 10 | 600 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 500 22 | 600 23 | 24 | 25 | 26 | Pixiv 27 | 28 | 29 | 30 | 31 | 32 | 0 33 | 0 34 | 498 35 | 571 36 | 37 | 38 | 39 | 40 | 41 | 42 | 0 43 | 44 | 45 | 46 | 搜索 47 | 48 | 49 | 50 | 51 | 10 52 | 140 53 | 101 54 | 31 55 | 56 | 57 | 58 | PointingHandCursor 59 | 60 | 61 | 查找 62 | 63 | 64 | 65 | 66 | 67 | 120 68 | 140 69 | 191 70 | 31 71 | 72 | 73 | 74 | 75 | 76 | 77 | 320 78 | 140 79 | 121 80 | 31 81 | 82 | 83 | 84 | 85 | 插画ID 86 | 87 | 88 | 89 | 90 | 画师ID 91 | 92 | 93 | 94 | 95 | 插画标题 96 | 97 | 98 | 99 | 100 | 101 | 102 | 10 103 | 180 104 | 101 105 | 31 106 | 107 | 108 | 109 | PointingHandCursor 110 | 111 | 112 | 随机插画 113 | 114 | 115 | 116 | 117 | 118 | 10 119 | 220 120 | 481 121 | 301 122 | 123 | 124 | 125 | font: 10pt "黑体"; 126 | 127 | 128 | 129 | Qt::ScrollBarAlwaysOn 130 | 131 | 132 | Qt::ScrollBarAlwaysOn 133 | 134 | 135 | QTextEdit::NoWrap 136 | 137 | 138 | 139 | 140 | 141 | 10 142 | 10 143 | 471 144 | 121 145 | 146 | 147 | 148 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 149 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 150 | p, li { white-space: pre-wrap; } 151 | </style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> 152 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Pixiv 小工具 v1.5 (基于Qt开发)</span></p> 153 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">输入你要查找的插画Id或者画师id,然后选择搜索类型,点查找即可。</span></p> 154 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">注意:不会自动跳转到对应页,请手动切换</span></p> 155 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">By Ealodi,QQ</span><span style=" font-weight:600; text-decoration: underline;">1049700117</span></p> 156 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">个人博客:https://ealodi.xyz</span></p></body></html> 157 | 158 | 159 | 160 | 161 | 162 | 插画 163 | 164 | 165 | 166 | 167 | 0 168 | 0 169 | 491 170 | 561 171 | 172 | 173 | 174 | 175 | 0 176 | 0 177 | 178 | 179 | 180 | Qt::ScrollBarAsNeeded 181 | 182 | 183 | Qt::ScrollBarAlwaysOff 184 | 185 | 186 | true 187 | 188 | 189 | 190 | 191 | 0 192 | 0 193 | 491 194 | 559 195 | 196 | 197 | 198 | 199 | 491 200 | 558 201 | 202 | 203 | 204 | 205 | 206 | 10 207 | 20 208 | 61 209 | 31 210 | 211 | 212 | 213 | 插画ID: 214 | 215 | 216 | 217 | 218 | 219 | 240 220 | 20 221 | 71 222 | 31 223 | 224 | 225 | 226 | 插画名称: 227 | 228 | 229 | 230 | 231 | 232 | 10 233 | 60 234 | 61 235 | 31 236 | 237 | 238 | 239 | 画师ID: 240 | 241 | 242 | 243 | 244 | 245 | 240 246 | 60 247 | 71 248 | 31 249 | 250 | 251 | 252 | 画师名称: 253 | 254 | 255 | 256 | 257 | 258 | 10 259 | 100 260 | 71 261 | 31 262 | 263 | 264 | 265 | 插画页数: 266 | 267 | 268 | 269 | 270 | 271 | 10 272 | 160 273 | 81 274 | 31 275 | 276 | 277 | 278 | 下载 279 | 280 | 281 | 282 | 283 | 284 | 90 285 | 20 286 | 141 287 | 31 288 | 289 | 290 | 291 | background-color:transparent; 292 | border-width:0;border-style:outset; 293 | font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 294 | 295 | 296 | 297 | 298 | 299 | 320 300 | 20 301 | 141 302 | 31 303 | 304 | 305 | 306 | background-color:transparent; 307 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 308 | 309 | 310 | 311 | 312 | 313 | 90 314 | 60 315 | 141 316 | 31 317 | 318 | 319 | 320 | background-color:transparent; 321 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 322 | 323 | 324 | 325 | 326 | 327 | 320 328 | 60 329 | 141 330 | 31 331 | 332 | 333 | 334 | background-color:transparent; 335 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 336 | 337 | 338 | 339 | 340 | 341 | 90 342 | 100 343 | 101 344 | 31 345 | 346 | 347 | 348 | background-color:transparent; 349 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 350 | 351 | 352 | 353 | 354 | 355 | 100 356 | 170 357 | 331 358 | 21 359 | 360 | 361 | 362 | 0 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 画师 371 | 372 | 373 | 374 | 375 | 0 376 | 0 377 | 491 378 | 561 379 | 380 | 381 | 382 | 383 | 0 384 | 0 385 | 386 | 387 | 388 | Qt::ScrollBarAsNeeded 389 | 390 | 391 | Qt::ScrollBarAlwaysOff 392 | 393 | 394 | true 395 | 396 | 397 | 398 | 399 | 0 400 | 0 401 | 491 402 | 559 403 | 404 | 405 | 406 | 407 | 491 408 | 558 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 查找tag 417 | 418 | 419 | 420 | 421 | 0 422 | 0 423 | 491 424 | 561 425 | 426 | 427 | 428 | 429 | 0 430 | 0 431 | 432 | 433 | 434 | Qt::ScrollBarAsNeeded 435 | 436 | 437 | Qt::ScrollBarAlwaysOff 438 | 439 | 440 | true 441 | 442 | 443 | 444 | 445 | 0 446 | 0 447 | 491 448 | 559 449 | 450 | 451 | 452 | 453 | 491 454 | 558 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 排行榜 463 | 464 | 465 | 466 | 467 | 0 468 | 0 469 | 491 470 | 561 471 | 472 | 473 | 474 | 475 | 0 476 | 0 477 | 478 | 479 | 480 | Qt::ScrollBarAsNeeded 481 | 482 | 483 | Qt::ScrollBarAlwaysOff 484 | 485 | 486 | true 487 | 488 | 489 | 490 | 491 | 0 492 | 0 493 | 491 494 | 600 495 | 496 | 497 | 498 | 499 | 491 500 | 600 501 | 502 | 503 | 504 | 505 | 506 | 50 507 | 20 508 | 110 509 | 22 510 | 511 | 512 | 513 | 514 | 0 515 | 0 516 | 0 517 | 2020 518 | 1 519 | 1 520 | 521 | 522 | 523 | yyyy-M-d 524 | 525 | 526 | 527 | 528 | 529 | 10 530 | 20 531 | 41 532 | 22 533 | 534 | 535 | 536 | 日期: 537 | 538 | 539 | 540 | 541 | 542 | 270 543 | 20 544 | 51 545 | 22 546 | 547 | 548 | 549 | 确定 550 | 551 | 552 | 553 | 554 | 555 | 170 556 | 20 557 | 87 558 | 22 559 | 560 | 561 | 562 | 563 | 日榜 564 | 565 | 566 | 567 | 568 | 周榜 569 | 570 | 571 | 572 | 573 | 月榜 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 设置 583 | 584 | 585 | 586 | 587 | 0 588 | 0 589 | 491 590 | 561 591 | 592 | 593 | 594 | 595 | 0 596 | 0 597 | 598 | 599 | 600 | Qt::ScrollBarAsNeeded 601 | 602 | 603 | Qt::ScrollBarAlwaysOff 604 | 605 | 606 | true 607 | 608 | 609 | 610 | 611 | 0 612 | 0 613 | 491 614 | 600 615 | 616 | 617 | 618 | 619 | 491 620 | 600 621 | 622 | 623 | 624 | 625 | 626 | 0 627 | 0 628 | 271 629 | 41 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 保存路径: 640 | 641 | 642 | 643 | 644 | 645 | 646 | ... 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 0 656 | 40 657 | 221 658 | 81 659 | 660 | 661 | 662 | 663 | 664 | 665 | 随机插画开启R18: 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 预览插画质量: 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 启动自行加载排行榜: 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 390 722 | 10 723 | 61 724 | 31 725 | 726 | 727 | 728 | PointingHandCursor 729 | 730 | 731 | 保存 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 0 743 | 0 744 | 500 745 | 26 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | -------------------------------------------------------------------------------- /Pixiv1.6/Pixiv.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | QT += network 3 | 4 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 5 | 6 | CONFIG += c++14 7 | 8 | # You can make your code fail to compile if it uses deprecated APIs. 9 | # In order to do so, uncomment the following line. 10 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 11 | 12 | SOURCES += \ 13 | main.cpp \ 14 | mylabel.cpp \ 15 | pixiv.cpp 16 | 17 | HEADERS += \ 18 | mylabel.h \ 19 | pixiv.h 20 | 21 | FORMS += \ 22 | pixiv.ui 23 | 24 | # Default rules for deployment. 25 | qnx: target.path = /tmp/$${TARGET}/bin 26 | else: unix:!android: target.path = /opt/$${TARGET}/bin 27 | !isEmpty(target.path): INSTALLS += target 28 | 29 | -------------------------------------------------------------------------------- /Pixiv1.6/Pixiv.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {7080c6a9-4485-4374-a0a2-196e33619203} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 1 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | true 45 | 0 46 | 8 47 | true 48 | 1 49 | true 50 | true 51 | true 52 | false 53 | 54 | 55 | 56 | ProjectExplorer.Project.PluginSettings 57 | 58 | 59 | true 60 | true 61 | true 62 | true 63 | 64 | 65 | 0 66 | true 67 | 68 | -fno-delayed-template-parsing 69 | 70 | false 71 | Builtin.Questionable 72 | 73 | true 74 | Builtin.DefaultTidyAndClazy 75 | 4 76 | 77 | 78 | 79 | true 80 | 81 | 82 | 83 | 84 | ProjectExplorer.Project.Target.0 85 | 86 | mingw32 87 | mingw32 88 | {d8f684c9-5d8c-4851-9a57-86336321fcec} 89 | 0 90 | 0 91 | 0 92 | 93 | true 94 | 0 95 | D:\Project\build-Pixiv-mingw32-Debug 96 | D:/Project/build-Pixiv-mingw32-Debug 97 | 98 | 99 | true 100 | QtProjectManager.QMakeBuildStep 101 | 102 | false 103 | 104 | 105 | 106 | true 107 | Qt4ProjectManager.MakeStep 108 | 109 | false 110 | 111 | 112 | false 113 | 114 | 2 115 | Build 116 | Build 117 | ProjectExplorer.BuildSteps.Build 118 | 119 | 120 | 121 | true 122 | Qt4ProjectManager.MakeStep 123 | 124 | true 125 | clean 126 | 127 | false 128 | 129 | 1 130 | Clean 131 | Clean 132 | ProjectExplorer.BuildSteps.Clean 133 | 134 | 2 135 | false 136 | 137 | QT_PLUGIN_PATH=C:\Qt\Qt5.12.9\5.12.9\mingw73_32\plugins 138 | 139 | Debug 140 | Qt4ProjectManager.Qt4BuildConfiguration 141 | 2 142 | 2 143 | 2 144 | 145 | 146 | true 147 | 2 148 | D:\Project\build-Pixiv-mingw32-Release 149 | D:/Project/build-Pixiv-mingw32-Release 150 | 151 | 152 | true 153 | QtProjectManager.QMakeBuildStep 154 | 155 | false 156 | 157 | 158 | 159 | true 160 | Qt4ProjectManager.MakeStep 161 | 162 | false 163 | 164 | 165 | false 166 | 167 | 2 168 | Build 169 | Build 170 | ProjectExplorer.BuildSteps.Build 171 | 172 | 173 | 174 | true 175 | Qt4ProjectManager.MakeStep 176 | 177 | true 178 | clean 179 | 180 | false 181 | 182 | 1 183 | Clean 184 | Clean 185 | ProjectExplorer.BuildSteps.Clean 186 | 187 | 2 188 | false 189 | 190 | Release 191 | Qt4ProjectManager.Qt4BuildConfiguration 192 | 0 193 | 0 194 | 2 195 | 196 | 197 | true 198 | 0 199 | D:\Project\build-Pixiv-mingw32-Profile 200 | D:/Project/build-Pixiv-mingw32-Profile 201 | 202 | 203 | true 204 | QtProjectManager.QMakeBuildStep 205 | 206 | false 207 | 208 | 209 | 210 | true 211 | Qt4ProjectManager.MakeStep 212 | 213 | false 214 | 215 | 216 | false 217 | 218 | 2 219 | Build 220 | Build 221 | ProjectExplorer.BuildSteps.Build 222 | 223 | 224 | 225 | true 226 | Qt4ProjectManager.MakeStep 227 | 228 | true 229 | clean 230 | 231 | false 232 | 233 | 1 234 | Clean 235 | Clean 236 | ProjectExplorer.BuildSteps.Clean 237 | 238 | 2 239 | false 240 | 241 | Profile 242 | Qt4ProjectManager.Qt4BuildConfiguration 243 | 0 244 | 0 245 | 0 246 | 247 | 3 248 | 249 | 250 | 0 251 | Deploy 252 | Deploy 253 | ProjectExplorer.BuildSteps.Deploy 254 | 255 | 1 256 | 257 | false 258 | ProjectExplorer.DefaultDeployConfiguration 259 | 260 | 1 261 | 262 | 263 | dwarf 264 | 265 | cpu-cycles 266 | 267 | 268 | 250 269 | 270 | -e 271 | cpu-cycles 272 | --call-graph 273 | dwarf,4096 274 | -F 275 | 250 276 | 277 | -F 278 | true 279 | 4096 280 | false 281 | false 282 | 1000 283 | 284 | true 285 | 286 | false 287 | false 288 | false 289 | false 290 | true 291 | 0.01 292 | 10 293 | true 294 | kcachegrind 295 | 1 296 | 25 297 | 298 | 1 299 | true 300 | false 301 | true 302 | valgrind 303 | 304 | 0 305 | 1 306 | 2 307 | 3 308 | 4 309 | 5 310 | 6 311 | 7 312 | 8 313 | 9 314 | 10 315 | 11 316 | 12 317 | 13 318 | 14 319 | 320 | 2 321 | 322 | Qt4ProjectManager.Qt4RunConfiguration:D:/Project/Pixiv/Pixiv.pro 323 | D:/Project/Pixiv/Pixiv.pro 324 | 325 | false 326 | 327 | false 328 | true 329 | true 330 | false 331 | false 332 | true 333 | 334 | D:/Project/build-Pixiv-mingw32-Debug 335 | 336 | 1 337 | 338 | 339 | 340 | ProjectExplorer.Project.Target.1 341 | 342 | 静态编译 343 | 静态编译 344 | {a481353f-8532-4146-9806-afaa00036f68} 345 | 1 346 | 0 347 | 0 348 | 349 | true 350 | 0 351 | D:\Project\build-Pixiv-unknown-Debug 352 | D:/Project/build-Pixiv-unknown-Debug 353 | 354 | 355 | true 356 | QtProjectManager.QMakeBuildStep 357 | 358 | false 359 | 360 | 361 | 362 | true 363 | Qt4ProjectManager.MakeStep 364 | 365 | false 366 | 367 | 368 | false 369 | 370 | 2 371 | Build 372 | Build 373 | ProjectExplorer.BuildSteps.Build 374 | 375 | 376 | 377 | true 378 | Qt4ProjectManager.MakeStep 379 | 380 | true 381 | clean 382 | 383 | false 384 | 385 | 1 386 | Clean 387 | Clean 388 | ProjectExplorer.BuildSteps.Clean 389 | 390 | 2 391 | false 392 | 393 | Debug 394 | Qt4ProjectManager.Qt4BuildConfiguration 395 | 2 396 | 2 397 | 2 398 | 399 | 400 | true 401 | 2 402 | D:\Project\build-Pixiv-unknown-Release 403 | D:/Project/build-Pixiv-unknown-Release 404 | 405 | 406 | true 407 | QtProjectManager.QMakeBuildStep 408 | 409 | false 410 | 411 | 412 | 413 | true 414 | Qt4ProjectManager.MakeStep 415 | 416 | false 417 | 418 | 419 | false 420 | 421 | 2 422 | Build 423 | Build 424 | ProjectExplorer.BuildSteps.Build 425 | 426 | 427 | 428 | true 429 | Qt4ProjectManager.MakeStep 430 | 431 | true 432 | clean 433 | 434 | false 435 | 436 | 1 437 | Clean 438 | Clean 439 | ProjectExplorer.BuildSteps.Clean 440 | 441 | 2 442 | false 443 | 444 | Release 445 | Qt4ProjectManager.Qt4BuildConfiguration 446 | 0 447 | 0 448 | 2 449 | 450 | 451 | true 452 | 0 453 | D:\Project\build-Pixiv-unknown-Profile 454 | D:/Project/build-Pixiv-unknown-Profile 455 | 456 | 457 | true 458 | QtProjectManager.QMakeBuildStep 459 | 460 | false 461 | 462 | 463 | 464 | true 465 | Qt4ProjectManager.MakeStep 466 | 467 | false 468 | 469 | 470 | false 471 | 472 | 2 473 | Build 474 | Build 475 | ProjectExplorer.BuildSteps.Build 476 | 477 | 478 | 479 | true 480 | Qt4ProjectManager.MakeStep 481 | 482 | true 483 | clean 484 | 485 | false 486 | 487 | 1 488 | Clean 489 | Clean 490 | ProjectExplorer.BuildSteps.Clean 491 | 492 | 2 493 | false 494 | 495 | Profile 496 | Qt4ProjectManager.Qt4BuildConfiguration 497 | 0 498 | 0 499 | 0 500 | 501 | 3 502 | 503 | 504 | 0 505 | Deploy 506 | Deploy 507 | ProjectExplorer.BuildSteps.Deploy 508 | 509 | 1 510 | 511 | false 512 | ProjectExplorer.DefaultDeployConfiguration 513 | 514 | 1 515 | 516 | 517 | dwarf 518 | 519 | cpu-cycles 520 | 521 | 522 | 250 523 | 524 | -e 525 | cpu-cycles 526 | --call-graph 527 | dwarf,4096 528 | -F 529 | 250 530 | 531 | -F 532 | true 533 | 4096 534 | false 535 | false 536 | 1000 537 | 538 | true 539 | 540 | false 541 | false 542 | false 543 | false 544 | true 545 | 0.01 546 | 10 547 | true 548 | kcachegrind 549 | 1 550 | 25 551 | 552 | 1 553 | true 554 | false 555 | true 556 | valgrind 557 | 558 | 0 559 | 1 560 | 2 561 | 3 562 | 4 563 | 5 564 | 6 565 | 7 566 | 8 567 | 9 568 | 10 569 | 11 570 | 12 571 | 13 572 | 14 573 | 574 | 2 575 | 576 | Qt4ProjectManager.Qt4RunConfiguration:D:/Project/Pixiv/Pixiv.pro 577 | D:/Project/Pixiv/Pixiv.pro 578 | 579 | false 580 | 581 | false 582 | true 583 | true 584 | false 585 | false 586 | true 587 | 588 | D:/Project/build-Pixiv-unknown-Release 589 | 590 | 1 591 | 592 | 593 | 594 | ProjectExplorer.Project.TargetCount 595 | 2 596 | 597 | 598 | ProjectExplorer.Project.Updater.FileVersion 599 | 22 600 | 601 | 602 | Version 603 | 22 604 | 605 | 606 | -------------------------------------------------------------------------------- /Pixiv1.6/main.cpp: -------------------------------------------------------------------------------- 1 | #include "pixiv.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | Pixiv w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Pixiv1.6/mylabel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "mylabel.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | Mylabel::Mylabel(QWidget* parent) 9 | :QLabel(parent) 10 | { 11 | this->setParent(parent); 12 | this->setMouseTracking(true); 13 | this->setObjectName("Mylabel"); 14 | } 15 | 16 | Mylabel::~Mylabel(){ 17 | if (!name) 18 | delete name; 19 | if (!pic_page) 20 | delete pic_page; 21 | } 22 | 23 | void Mylabel::mousePressEvent(QMouseEvent* event) 24 | { 25 | if(event->button() == Qt::LeftButton) 26 | emit clicked(); 27 | } 28 | 29 | void Mylabel::SetName(QString na){ 30 | name = new QLabel(this); 31 | name->setText(na); 32 | name->setStyleSheet("background: rgba(0,0,0,.375);font-family: 黑体;text-align: center;color: white;border-width:0;font-weight: 600;font-size: 20px;"); 33 | name->setFixedHeight(this->height() / 3); 34 | name->setFixedWidth(this->width()); 35 | name->move(0,this->height() / 3 * 2); 36 | } 37 | 38 | void Mylabel::SetPage(QString page){ 39 | pic_page = new QToolButton(this); 40 | pic_page->setText(page); 41 | pic_page->setFixedWidth(40); 42 | pic_page->setFixedHeight(30); 43 | pic_page->setAttribute(Qt::WA_TranslucentBackground,true); 44 | pic_page->setStyleSheet("border-radius: 9px;background: rgba(0,0,0,.375);font-family: 黑体;text-align: center;color: white;border-width:0;font-weight: 600;font-size: 20px;"); 45 | pic_page->move(this->width() - pic_page->width() - 5,5); 46 | pic_page->setEnabled(false); 47 | } 48 | 49 | void Mylabel::Seteffect(){ 50 | QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect; 51 | effect->setOffset(4, 4); 52 | effect->setColor(QColor(0, 0, 0, 50)); 53 | effect->setBlurRadius(10); 54 | this->setGraphicsEffect(effect); 55 | } 56 | -------------------------------------------------------------------------------- /Pixiv1.6/mylabel.h: -------------------------------------------------------------------------------- 1 | #ifndef MYLABEL_H 2 | #define MYLABEL_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include"QMessageBox" 8 | #include 9 | #include 10 | class Mylabel: public QLabel 11 | { 12 | Q_OBJECT 13 | public: 14 | Mylabel(QWidget *parent=0); 15 | ~Mylabel(); 16 | void SetName(QString); 17 | void SetPage(QString); 18 | void Seteffect(); 19 | signals: 20 | void clicked(); 21 | 22 | protected: 23 | //void enterEvent(QEvent *); 24 | //void leaveEvent(QEvent *); 25 | void mousePressEvent(QMouseEvent* event); 26 | 27 | private: 28 | QLabel *name; 29 | QToolButton *pic_page; 30 | }; 31 | 32 | #endif // MYLABEL_H 33 | -------------------------------------------------------------------------------- /Pixiv1.6/pixiv.cpp: -------------------------------------------------------------------------------- 1 | #include "pixiv.h" 2 | #include "ui_pixiv.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "mylabel.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #define FIRST_HOST "210.140.92.138" 17 | #define Message(A,B) QMessageBox::information(NULL, A,B ,QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) 18 | 19 | 20 | /*全局变量*/ 21 | SOFTWARE_VERSION VERSION = "1.6"; 22 | ImgInfo *m_imgs = new ImgInfo;//图片信息 23 | std::vectorm_Articlelabel;//上一次显示的作家label指针 24 | Mylabel* m_AHead;//画师头像 25 | Setting *m_set = new Setting;//设置信息 26 | ScrollDisPlay *All_Pics = new ScrollDisPlay; 27 | /*全局变量*/ 28 | 29 | Pixiv::Pixiv(QWidget *parent) 30 | : QMainWindow(parent) 31 | , ui(new Ui::Pixiv) 32 | { 33 | ui->setupUi(this); 34 | ui->scrollArea->setFrameShape(QFrame::NoFrame); 35 | ui->scrollArea_2->setFrameShape(QFrame::NoFrame); 36 | ui->scrollArea_3->setFrameShape(QFrame::NoFrame); 37 | ui->scrollArea_4->setFrameShape(QFrame::NoFrame); 38 | ui->scrollArea_5->setFrameShape(QFrame::NoFrame); 39 | //设置https 40 | request = new QNetworkRequest; 41 | m_accessManager = new QNetworkAccessManager(); 42 | 43 | QSslConfiguration config; 44 | QSslConfiguration conf = request->sslConfiguration(); 45 | conf.setPeerVerifyMode(QSslSocket::VerifyNone); 46 | conf.setProtocol(QSsl::TlsV1SslV3); 47 | request->setSslConfiguration(conf); 48 | connect(m_accessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(finishedSlot(QNetworkReply*))); 49 | //判断最新版本 50 | QNetworkAccessManager manager; 51 | QEventLoop loop; 52 | request->setUrl(QUrl("https://gitee.com/ailou/pixiv/raw/master/version.txt")); 53 | QNetworkReply *reply = manager.get(*request); 54 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 55 | loop.exec(); 56 | QByteArray content = reply->readAll(); 57 | 58 | QString version(content); 59 | if (version != VERSION) 60 | { 61 | if (QMessageBox::Yes == Message("提示","网络未连接或者已有新版本,请前往https://www.52pojie.cn/home.php?mod=space&uid=1611144查看。")) 62 | { 63 | QDesktopServices::openUrl(QString("https://www.52pojie.cn/home.php?mod=space&uid=1611144")); 64 | } 65 | } 66 | //读取设置内容 67 | ReadSetting(); 68 | ui->lineEdit_2->setText(m_set->path); 69 | ui->checkBox->setChecked(m_set->R18); 70 | ui->checkBox_2->setChecked(m_set->rankAuto); 71 | ui->comboBox_2->setCurrentIndex(m_set->PicQuality); 72 | //连接信号 73 | connect(this,SIGNAL(StartSearchPic(QString)),this,SLOT(PicClicked(QString))); 74 | connect(this,SIGNAL(StartSearchArt(QString)),this,SLOT(ArticleClicked(QString))); 75 | connect(this,SIGNAL(StartSearchRank(QString,QString)),this,SLOT(rank(QString,QString))); 76 | connect(this,SIGNAL(StartSearchTag(QString)),this,SLOT(TagSearch(QString))); 77 | //加载最近排行榜 78 | if (m_set->rankAuto){ 79 | QDateTime begin_time = QDateTime::currentDateTime(); 80 | QString date = begin_time.addDays(-2).toString("yyyy-MM-dd"); 81 | QDate current_date =QDate::currentDate(); 82 | ui->dateEdit->setDate(current_date.addDays(-2)); 83 | emit StartSearchRank("day",date); 84 | } 85 | } 86 | 87 | Pixiv::~Pixiv() 88 | { 89 | delete ui; 90 | delete request; 91 | delete m_accessManager; 92 | } 93 | //接收函数 94 | void Pixiv::finishedSlot(QNetworkReply *reply) 95 | { 96 | 97 | if (reply->error() == QNetworkReply::NoError) 98 | { 99 | QByteArray bytes = reply->readAll(); 100 | emit Requestover(bytes); 101 | } 102 | else 103 | { 104 | qDebug()<<"handle errors here"; 105 | QVariant statusCodeV = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); 106 | //statusCodeV是HTTP服务器的相应码,reply->error()是Qt定义的错误码,可以参考QT的文档 107 | qDebug() << reply->error(); 108 | Message("Request Error: ",QString::number(statusCodeV.toInt())+" " + QString::number((int)reply->error())); 109 | print("Request Error: " + QString::number(statusCodeV.toInt())+" " + QString::number((int)reply->error())); 110 | } 111 | reply->deleteLater(); 112 | } 113 | 114 | void Pixiv::on_toolButton_clicked() 115 | { 116 | int choice = ui->comboBox->currentIndex(); 117 | switch (choice) { 118 | case 0:emit StartSearchPic(ui->lineEdit->text());break; 119 | case 1:emit StartSearchArt(ui->lineEdit->text());break; 120 | case 2: 121 | emit StartSearchTag(ui->lineEdit->text()); 122 | break; 123 | } 124 | 125 | } 126 | 127 | void Pixiv::DealSearchContent(QByteArray& content){ 128 | cleanLast(ui->scrollAreaWidgetContents); 129 | m_imgs->clear(); 130 | QJsonDocument doc = QJsonDocument::fromJson(content); 131 | QJsonObject obj = doc.object().value("illust").toObject(); 132 | 133 | m_imgs->SetPicID(obj.value("id").toInt()); 134 | m_imgs->SetStatus_code(200); 135 | m_imgs->SetPage_count(obj.value("page_count").toInt()); 136 | m_imgs->SetUserID(obj.value("user").toObject().value("id").toInt()); 137 | m_imgs->SetPicName(obj.value("title").toString()); 138 | m_imgs->SetUserName(obj.value("user").toObject().value("name").toString()); 139 | 140 | ui->pname->setText(m_imgs->GetPicName()); 141 | ui->pname->setCursorPosition(0); 142 | ui->pid->setText(QString::number(m_imgs->GetPicID())); 143 | ui->aname->setText(m_imgs->GetUserName()); 144 | ui->aname->setCursorPosition(0); 145 | ui->aid->setText(QString::number(m_imgs->GetUserID())); 146 | ui->page->setText(QString::number(m_imgs->GetPage_count())); 147 | 148 | QString quality = m_set->GetPicQuality(); 149 | 150 | if (m_imgs->GetPage_count() == 1){ 151 | m_imgs->PushAUrlToMedium(ChanHost(obj.value("image_urls").toObject().value(quality).toString(),FIRST_HOST)); 152 | m_imgs->PushAUrlToOrigin(ChanHost(obj.value("meta_single_page").toObject().value("original_image_url").toString(),FIRST_HOST)); 153 | } 154 | else { 155 | QJsonArray array = obj.value("meta_pages").toArray(); 156 | for (int i = 0;i < array.size();i++){ 157 | m_imgs->PushAUrlToMedium(ChanHost(array.at(i).toObject().value("image_urls").toObject().value(quality).toString(),FIRST_HOST)); 158 | m_imgs->PushAUrlToOrigin(ChanHost(array.at(i).toObject().value("image_urls").toObject().value("original").toString(),FIRST_HOST)); 159 | } 160 | } 161 | 162 | QNetworkAccessManager manager; 163 | QEventLoop loop; 164 | 165 | for (int i = 0;i < (int)m_imgs->GetPage_count();i++){ 166 | request->setUrl(QUrl(m_imgs->square_medium[i])); 167 | request->setRawHeader("referer","https://www.pixiv.net"); 168 | QNetworkReply *reply = manager.get(*request); 169 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 170 | //开启子事件循环 171 | loop.exec(); 172 | QByteArray Pic = reply->readAll(); 173 | 174 | QImage img; 175 | img.loadFromData(Pic); 176 | int y = GetLargestY(ui->scrollAreaWidgetContents); 177 | Mylabel *label = new Mylabel(ui->scrollAreaWidgetContents); 178 | 179 | int width = img.width(),height = img.height(); 180 | double times = 1; 181 | while(width > 450 || height > 400){ 182 | times += 0.1; 183 | width = img.width() / times; 184 | height = img.height() / times; 185 | } 186 | label->setFixedHeight(height); 187 | label->setFixedWidth(width); 188 | label->setScaledContents(true); 189 | label->move(491 / 2 - width / 2,y + 10); 190 | ui->scrollAreaWidgetContents->setMinimumHeight(GetLargestY(ui->scrollAreaWidgetContents) + 50); 191 | label->setPixmap(Radius(img,15)); 192 | label->setStyleSheet("border: 2px solid #808080;border-radius: 15px;"); 193 | label->show(); 194 | print("显示图片成功!"); 195 | reply->deleteLater(); 196 | } 197 | } 198 | 199 | void Pixiv::print(QString info){ 200 | ui->textEdit->append(GetTime() + ": " + info); 201 | //qDebug() << GetTime() + ": " << info; 202 | } 203 | 204 | QString ChanHost(QString url,QString hosts) 205 | { 206 | int s = url.indexOf("://",0,Qt::CaseInsensitive) + 3; 207 | int e = url.indexOf("/",s,Qt::CaseInsensitive); 208 | QString host = url.mid(s,e - s); 209 | return url.replace(host,hosts); 210 | } 211 | //查找随机图 212 | void Pixiv::on_toolButton_2_clicked() 213 | { 214 | //准备 215 | print("查找随机插画。"); 216 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//清空Requestover的所有槽 217 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealRadomPic(QByteArray&))); 218 | //开始 219 | QString r18 = ""; 220 | if (m_set->R18)r18 = "&r18=true"; 221 | 222 | QString url = "https://api.loli.st/pixiv/random.php?type=json" + r18; 223 | request->setUrl(QUrl(url)); 224 | request->setRawHeader("user-agent", 225 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 226 | m_accessManager->get(*request); 227 | } 228 | //随机图片处理 229 | void Pixiv::DealRadomPic(QByteArray& content){ 230 | print("正常处理随机插画!"); 231 | QJsonObject doc = QJsonDocument::fromJson(content).object(); 232 | QString id = doc.value("illust_id").toString(); 233 | emit StartSearchPic(id); 234 | } 235 | //下载 236 | void Pixiv::on_toolButton_3_clicked() 237 | { 238 | print("开始下载图片数据!"); 239 | ui->progressBar_2->setMinimum(0); 240 | ui->progressBar_2->setMaximum(m_imgs->GetPage_count() * 1000); 241 | ui->progressBar_2->setValue(0); 242 | std::vectorlasts(m_imgs->GetPage_count(),0); 243 | for (int i = 0;i < int(m_imgs->GetPage_count());i++){ 244 | QNetworkAccessManager *manager = new QNetworkAccessManager; 245 | 246 | connect(manager, &QNetworkAccessManager::finished, [=](QNetworkReply* reply)mutable{ 247 | QByteArray bytes = reply->readAll(); 248 | int last = m_imgs->original[i].lastIndexOf("/"); 249 | QString name = m_imgs->original[i].mid(last); 250 | QFile file; 251 | file.setFileName(m_set->path + name); 252 | file.open(QIODevice::WriteOnly); 253 | file.write(bytes); 254 | file.close(); 255 | ui->progressBar_2->setValue(m_imgs->GetPage_count() * 1000); 256 | print("下载完成! " + name); 257 | reply->deleteLater(); 258 | }); 259 | //发出请求 260 | request->setUrl(QUrl(m_imgs->original[i])); 261 | request->setRawHeader("referer","https://www.pixiv.net"); 262 | QNetworkReply* reply = manager->get(*request); 263 | connect(reply, &QNetworkReply::downloadProgress, [=](qint64 now,qint64 all)mutable{ 264 | double a = now,b = all; 265 | ui->progressBar_2->setValue(ui->progressBar_2->value() + (double)((a-lasts[i]) / b) * 1000); 266 | lasts[i] = now; 267 | }); 268 | } 269 | } 270 | //读取设置 271 | void ReadSetting(){ 272 | QFile file; 273 | file.setFileName("./pix_config.json"); 274 | if (file.open(QIODevice::ReadOnly)) 275 | { 276 | QByteArray content = file.readAll(); 277 | QJsonDocument doc = QJsonDocument::fromJson(content); 278 | QJsonObject obj = doc.object(); 279 | m_set->path = obj.value("path").toString(); 280 | m_set->R18 = obj.value("R18").toBool(); 281 | m_set->PicQuality = obj.value("PicQuality").toInt(); 282 | m_set->rankAuto = obj.value("rankAuto").toBool(); 283 | 284 | } 285 | else { 286 | file.close(); 287 | file.open(QIODevice::WriteOnly); 288 | QJsonObject obj; 289 | obj.insert("path",m_set->path); 290 | obj.insert("R18",m_set->R18); 291 | obj.insert("rankAuto",m_set->rankAuto); 292 | obj.insert("PicQuality",m_set->PicQuality); 293 | QJsonDocument document=QJsonDocument(obj); 294 | QByteArray array = document.toJson(); 295 | file.write(array); 296 | } 297 | file.close(); 298 | } 299 | //保存设置 300 | void Pixiv::on_toolButton_4_clicked() 301 | { 302 | QFile file("./pix_config.json"); 303 | file.open(QIODevice::WriteOnly); 304 | QJsonObject obj; 305 | obj.insert("path",ui->lineEdit_2->text()); 306 | obj.insert("R18",ui->checkBox->isChecked()); 307 | obj.insert("rankAuto",ui->checkBox_2->isChecked()); 308 | obj.insert("PicQuality",ui->comboBox_2->currentIndex()); 309 | m_set->path = ui->lineEdit_2->text(); 310 | m_set->R18 = ui->checkBox->isChecked(); 311 | m_set->PicQuality = ui->comboBox_2->currentIndex(); 312 | m_set->rankAuto = ui->checkBox_2->isChecked(); 313 | QJsonDocument document=QJsonDocument(obj); 314 | QByteArray array = document.toJson(); 315 | file.write(array); 316 | file.close(); 317 | 318 | print("保存设置成功!"); 319 | 320 | Message("提示","保存成功!"); 321 | 322 | } 323 | //浏览文件夹 324 | void Pixiv::on_liulan_clicked() 325 | { 326 | QString paths = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, "选择保存路径", QDir::currentPath())); 327 | ui->lineEdit_2->setText(paths); 328 | } 329 | //画师 330 | void Pixiv::ArticleClicked(QString id){ 331 | print("开始查找画师:" + ui->lineEdit->text() + "。"); 332 | //准备 333 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//清空Requestover的所有槽 334 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealAritcleContent(QByteArray&))); 335 | //开始 336 | QString url = "https://pixiviz.pwp.app/api/v1/user/detail?id=" + id;; 337 | request->setUrl(QUrl(url)); 338 | request->setRawHeader("Referer","https://pixiviz.pwp.app/artist/" + id.toUtf8()); 339 | request->setRawHeader("user-agent", 340 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 341 | m_accessManager->get(*request); 342 | } 343 | //处理画师信息 344 | void Pixiv::DealAritcleContent(QByteArray& content){ 345 | if (All_Pics->stop_art == false){ 346 | All_Pics->stop_art = true; 347 | int msec = 3000; 348 | QTime dieTime = QTime::currentTime().addMSecs(msec); 349 | while (QTime::currentTime() < dieTime) 350 | QCoreApplication::processEvents(QEventLoop::AllEvents, 100); 351 | All_Pics->stop_art = false; 352 | } 353 | else All_Pics->stop_art = false; 354 | 355 | All_Pics->Clean(ScrollDisPlay::ART); 356 | ui->scrollArea_3->verticalScrollBar()->setSliderPosition(0); 357 | cleanLast(ui->scrollAreaWidgetContents_3); 358 | ui->scrollAreaWidgetContents_3->setFixedHeight(ui->scrollArea_3->height() + 10); 359 | connect(ui->scrollArea_3->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_3_Bar_Down); 360 | 361 | QJsonDocument doc = QJsonDocument::fromJson(content); 362 | QJsonObject obj = doc.object(); 363 | QString id = QString::number(obj.value("user").toObject().value("id").toInt()); 364 | QString name = obj.value("user").toObject().value("name").toString(); 365 | QString headUrl = ChanHost(obj.value("user").toObject().value("profile_image_urls").toObject().value("medium").toString(),FIRST_HOST); 366 | QString comment = obj.value("user").toObject().value("comment").toString(); 367 | int PicNum = obj.value("profile").toObject().value("total_illusts").toInt(); 368 | int MangaNum = obj.value("profile").toObject().value("total_manga").toInt(); 369 | int novelsNum = obj.value("profile").toObject().value("total_novels").toInt(); 370 | 371 | m_Articlelabel.clear(); 372 | for (int i = 0;i < 8;i++){ 373 | Mylabel *label = new Mylabel(ui->scrollAreaWidgetContents_3); 374 | m_Articlelabel.push_back(label); 375 | } 376 | //画师名称 377 | m_Articlelabel[0]->setText(name); 378 | m_Articlelabel[0]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 379 | m_Articlelabel[0]->adjustSize(); 380 | m_Articlelabel[0]->move(491 / 2 - m_Articlelabel[0]->width() / 2,220); 381 | m_Articlelabel[0]->show(); 382 | 383 | int y1 = m_Articlelabel[0]->pos().y() + m_Articlelabel[0]->height() + 20; 384 | m_Articlelabel[2]->setText("漫画"); 385 | m_Articlelabel[2]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 386 | m_Articlelabel[2]->adjustSize(); 387 | m_Articlelabel[2]->move(m_Articlelabel[0]->pos().x() + m_Articlelabel[0]->width() / 2 - m_Articlelabel[2]->width() / 2,y1); 388 | m_Articlelabel[2]->show(); 389 | 390 | m_Articlelabel[1]->setText("插画"); 391 | m_Articlelabel[1]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 392 | m_Articlelabel[1]->adjustSize(); 393 | m_Articlelabel[1]->move(m_Articlelabel[2]->pos().x() - 40 - m_Articlelabel[2]->width() / 2,y1); 394 | m_Articlelabel[1]->show(); 395 | 396 | m_Articlelabel[3]->setText("小说"); 397 | m_Articlelabel[3]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 398 | m_Articlelabel[3]->adjustSize(); 399 | m_Articlelabel[3]->move(m_Articlelabel[2]->pos().x() + m_Articlelabel[2]->width() / 2 + 40,y1); 400 | m_Articlelabel[3]->show(); 401 | 402 | 403 | int y2 = m_Articlelabel[1]->pos().y() + m_Articlelabel[1]->height(); 404 | m_Articlelabel[4]->setText(QString::number(PicNum)); 405 | m_Articlelabel[4]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 406 | m_Articlelabel[4]->adjustSize(); 407 | m_Articlelabel[4]->move(m_Articlelabel[1]->pos().x() + m_Articlelabel[1]->width() / 2 - m_Articlelabel[4]->width() / 2,y2); 408 | m_Articlelabel[4]->show(); 409 | 410 | m_Articlelabel[5]->setText(QString::number(MangaNum)); 411 | m_Articlelabel[5]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 412 | m_Articlelabel[5]->adjustSize(); 413 | m_Articlelabel[5]->move(m_Articlelabel[2]->pos().x() + m_Articlelabel[2]->width() / 2 - m_Articlelabel[5]->width() / 2,y2); 414 | m_Articlelabel[5]->show(); 415 | 416 | m_Articlelabel[6]->setText(QString::number(novelsNum)); 417 | m_Articlelabel[6]->setStyleSheet("font-family: 黑体;font-size: 26px;text-align: center;color: #da7a85;font-weight: 600;"); 418 | m_Articlelabel[6]->adjustSize(); 419 | m_Articlelabel[6]->move(m_Articlelabel[3]->pos().x() + m_Articlelabel[3]->width() / 2 - m_Articlelabel[6]->width() / 2,y2); 420 | m_Articlelabel[6]->show(); 421 | 422 | m_Articlelabel[7]->setText(comment); 423 | m_Articlelabel[7]->setStyleSheet("font-family: 黑体;font-size: 14px;font-weight: 400;color: #da7a85;line-height: 24px;"); 424 | m_Articlelabel[7]->adjustSize(); 425 | m_Articlelabel[7]->move(491 / 2 - m_Articlelabel[7]->width() / 2,m_Articlelabel[6]->pos().y() + m_Articlelabel[6]->height() + 20); 426 | m_Articlelabel[7]->show(); 427 | QNetworkAccessManager *manager = new QNetworkAccessManager; 428 | //发出请求 429 | request->setUrl(QUrl(headUrl)); 430 | print("载入画师头像。"); 431 | request->setRawHeader("referer","https://www.pixiv.net"); 432 | manager->get(*request); 433 | connect(manager,&QNetworkAccessManager::finished,[=](QNetworkReply *reply){ 434 | 435 | QByteArray contents = reply->readAll(); 436 | print("画师头像大小: " + QString::number(contents.size())); 437 | 438 | QImage toux; 439 | toux.loadFromData(contents); 440 | int width = toux.width(),height = toux.height(); 441 | double times = 1; 442 | while(width > 200 || height > 200){ 443 | times += 0.1; 444 | width = toux.width() / times; 445 | height = toux.height() / times; 446 | } 447 | 448 | m_AHead = new Mylabel(ui->scrollAreaWidgetContents_3); 449 | m_AHead->setFixedHeight(height); 450 | m_AHead->setFixedWidth(width); 451 | m_AHead->setPixmap(Radius(toux,width / 2)); 452 | m_AHead->setScaledContents(true); 453 | m_AHead->move(491 / 2 - width / 2,20); 454 | m_AHead->show(); 455 | print("载入画师头像完成!"); 456 | 457 | reply->deleteLater(); 458 | }); 459 | 460 | int page = 1; 461 | for (int i = 0;i < PicNum / 30 + 1;i++){ 462 | PicContent l; 463 | All_Pics->allPic_art->push_back(l); 464 | } 465 | while(page < PicNum / 30 + 2){ 466 | QNetworkAccessManager *manager_3 = new QNetworkAccessManager; 467 | QString url = "https://pixiviz.pwp.app/api/v1/user/illusts?id=" + id + "&page=" + QString::number(page); 468 | request->setUrl(QUrl(url)); 469 | request->setRawHeader("Referer","https://pixiviz.pwp.app/artist/" + id.toUtf8()); 470 | request->setRawHeader("user-agent", 471 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 472 | connect(manager_3,&QNetworkAccessManager::finished,[=](QNetworkReply *reply)mutable{ 473 | int true_page = page - 1; 474 | Oset* artPic = All_Pics->allPic_art; 475 | 476 | QByteArray contents = reply->readAll(); 477 | QJsonDocument doc = QJsonDocument::fromJson(contents); 478 | QJsonObject obj = doc.object(); 479 | 480 | QJsonArray AtPics = obj.value("illusts").toArray(); 481 | qDebug() << AtPics.size(); 482 | if (AtPics.size() == 0){ 483 | return; 484 | } 485 | QString quality = m_set->GetPicQuality(); 486 | if (AtPics.size() > 0){ 487 | for (int l = 0;l < AtPics.size();l++){ 488 | DisPlay_PicContent k; 489 | artPic->at(true_page).push_back(k); 490 | } 491 | } 492 | for (int i = 0;i < AtPics.size();i++){ 493 | if (All_Pics->stop_art == true){ 494 | return; 495 | } 496 | QString url = ChanHost(AtPics.at(i).toObject().value("image_urls").toObject().value(quality).toString(),FIRST_HOST); 497 | request->setUrl(QUrl(url)); 498 | QNetworkAccessManager *manager_2 = new QNetworkAccessManager; 499 | request->setRawHeader("Referer","https://www.pixiv.net"); 500 | manager_2->get(*request); 501 | connect(manager_2, &QNetworkAccessManager::finished, [=](QNetworkReply *replys){ 502 | if (All_Pics->stop_art == true)return; 503 | QByteArray content = replys->readAll(); 504 | QImage image; 505 | image.loadFromData(content); 506 | QPixmap b = Radius(image,15); 507 | 508 | artPic->at(true_page).at(i).value = true; 509 | artPic->at(true_page).at(i).image = b.toImage(); 510 | artPic->at(true_page).at(i).title = AtPics.at(i).toObject().value("title").toString(); 511 | artPic->at(true_page).at(i).page_count = QString::number(AtPics.at(i).toObject().value("page_count").toInt()); 512 | QJsonObject newobj; 513 | newobj.insert("illust",AtPics.at(i).toObject()); 514 | QByteArray byte = QJsonDocument(newobj).toJson(QJsonDocument::Compact); 515 | artPic->at(true_page).at(i).content = byte; 516 | 517 | replys->deleteLater(); 518 | }); 519 | } 520 | reply->deleteLater(); 521 | }); 522 | manager_3->get(*request); 523 | page++; 524 | } 525 | 526 | } 527 | //插画爬取 528 | void Pixiv::PicClicked(QString id){ 529 | //准备 530 | ui->scrollAreaWidgetContents->setFixedHeight(ui->scrollArea->height()); 531 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//情况Requestover的所有槽 532 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealSearchContent(QByteArray&))); 533 | 534 | //开始 535 | print("开始获取插画。"); 536 | QString url = "https://pixiviz.pwp.app/api/v1/illust/detail?id=" + id; 537 | request->setUrl(QUrl(url)); 538 | request->setRawHeader("Referer","https://pixiviz.pwp.app/"); 539 | request->setRawHeader("user-agent", 540 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 541 | m_accessManager->get(*request); 542 | } 543 | //获取当前时间 544 | QString GetTime(){ 545 | QDateTime current_date_time = QDateTime::currentDateTime(); 546 | QString current_date = current_date_time.toString("hh:mm:ss"); 547 | return current_date; 548 | } 549 | 550 | void Pixiv::on_textEdit_textChanged() 551 | { 552 | ui->textEdit->moveCursor(QTextCursor::End); 553 | } 554 | //排行榜时间被选择 555 | void Pixiv::on_pushButton_2_clicked() 556 | { 557 | QString date = ui->dateEdit->text(); 558 | for(int i = 0;i < date.size();i++){ 559 | if (date.at(i) == "-" && i == date.size() - 2) 560 | { 561 | date.remove(i,1); 562 | date.insert(i,"-0"); 563 | break; 564 | } 565 | if (date.at(i) == "-" && date.at(i + 2) == "-"){ 566 | date.remove(i,1); 567 | date.insert(i,"-0"); 568 | } 569 | } 570 | int choice = ui->comboBox_3->currentIndex(); 571 | QString mode = ""; 572 | switch (choice) { 573 | case 0: 574 | mode = "day"; 575 | break; 576 | case 1: 577 | mode = "week"; 578 | break; 579 | case 2: 580 | mode = "month"; 581 | break; 582 | default: 583 | break; 584 | } 585 | emit StartSearchRank(mode,date); 586 | } 587 | //排行榜获取 588 | void Pixiv::rank(QString mode,QString time){ 589 | if (All_Pics->stop_rank == false){ 590 | All_Pics->stop_rank = true; 591 | int msec = 3000; 592 | QTime dieTime = QTime::currentTime().addMSecs(msec); 593 | while (QTime::currentTime() < dieTime) 594 | QCoreApplication::processEvents(QEventLoop::AllEvents, 100); 595 | All_Pics->stop_art = false; 596 | } 597 | else All_Pics->stop_rank = false; 598 | print("开始爬取排行榜."); 599 | cleanLast(ui->scrollAreaWidgetContents_4); 600 | All_Pics->Clean(ScrollDisPlay::RANK); 601 | ui->scrollAreaWidgetContents_4->setFixedHeight(ui->scrollArea_4->height()); 602 | connect(ui->scrollArea_4->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_4_Bar_Down); 603 | 604 | int page = 1; 605 | for (int i = 0;i < 3;i++){ 606 | PicContent l; 607 | All_Pics->allPic_rank->push_back(l); 608 | } 609 | ui->scrollAreaWidgetContents_4->setFixedHeight(ui->scrollArea_4->height() + 10); 610 | while(page <= 3){ 611 | QString url = "https://pixiviz.pwp.app/api/v1/illust/rank?mode=" + mode + "&date=" + time + "&page=" + QString::number(page); 612 | QNetworkAccessManager *manager = new QNetworkAccessManager; 613 | connect(manager,&QNetworkAccessManager::finished,[=](QNetworkReply *reply)mutable{ 614 | int true_page = page - 1; 615 | Oset* rankPic = All_Pics->allPic_rank; 616 | 617 | QByteArray content = reply->readAll(); 618 | QJsonDocument doc = QJsonDocument::fromJson(content); 619 | QJsonObject obj = doc.object(); 620 | 621 | QJsonArray AtPics = obj.value("illusts").toArray(); 622 | if (AtPics.size() == 0)return; 623 | QString quality = m_set->GetPicQuality(); 624 | if (AtPics.size() > 0){ 625 | for (int l = 0;l < AtPics.size();l++){ 626 | DisPlay_PicContent k; 627 | rankPic->at(true_page).push_back(k); 628 | } 629 | } 630 | for (int i = 0;i < AtPics.size();i++){ 631 | if (All_Pics->stop_rank == true){ 632 | return; 633 | } 634 | QNetworkAccessManager *manager_2 = new QNetworkAccessManager; 635 | QString url = ChanHost(AtPics.at(i).toObject().value("image_urls").toObject().value(quality).toString(),FIRST_HOST); 636 | request->setUrl(QUrl(ChanHost(url,FIRST_HOST))); 637 | request->setRawHeader("referer","https://www.pixiv.net"); 638 | connect(manager_2, &QNetworkAccessManager::finished, [=](QNetworkReply *replys){ 639 | if (All_Pics->stop_rank == true){ 640 | return; 641 | } 642 | QByteArray content = replys->readAll(); 643 | QImage image; 644 | image.loadFromData(content); 645 | 646 | rankPic->at(true_page).at(i).value = true; 647 | rankPic->at(true_page).at(i).image = Radius(image,15).toImage(); 648 | rankPic->at(true_page).at(i).title = AtPics.at(i).toObject().value("title").toString(); 649 | rankPic->at(true_page).at(i).page_count = QString::number(AtPics.at(i).toObject().value("page_count").toInt()); 650 | QJsonObject newobj; 651 | newobj.insert("illust",AtPics.at(i).toObject()); 652 | QByteArray byte = QJsonDocument(newobj).toJson(QJsonDocument::Compact); 653 | rankPic->at(true_page).at(i).content = byte; 654 | 655 | replys->deleteLater(); 656 | }); 657 | manager_2->get(*request); 658 | } 659 | reply->deleteLater(); 660 | }); 661 | request->setUrl(QUrl(url)); 662 | request->setRawHeader("Referer","https://pixiviz.pwp.app"); 663 | request->setRawHeader("user-agent", 664 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"); 665 | manager->get(*request); 666 | page++; 667 | } 668 | 669 | } 670 | 671 | QPixmap Pixiv::Radius(QImage &pic,int radius){ 672 | int width = pic.width(); 673 | int height = pic.height(); 674 | 675 | QPixmap pixmap(width,height); 676 | pixmap.fill(Qt::transparent); 677 | QPainter painter(&pixmap); 678 | painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); 679 | QPainterPath path; 680 | path.addRoundedRect(0,0,width, height,radius,radius); 681 | painter.setClipPath(path); 682 | painter.drawPixmap(0, 0, width, height, QPixmap::fromImage(pic));//将显示图片的pixmap画入矩形框内 683 | return pixmap; 684 | } 685 | 686 | void Pixiv::TagSearch(QString word) 687 | { 688 | if (All_Pics->stop_tag == false){ 689 | All_Pics->stop_tag = true; 690 | int msec = 3000; 691 | QTime dieTime = QTime::currentTime().addMSecs(msec); 692 | while (QTime::currentTime() < dieTime) 693 | QCoreApplication::processEvents(QEventLoop::AllEvents, 100); 694 | All_Pics->stop_art = false; 695 | 696 | } 697 | else All_Pics->stop_tag = false; 698 | 699 | cleanLast(ui->scrollAreaWidgetContents_5); 700 | All_Pics->Clean(ScrollDisPlay::TAG); 701 | ui->scrollAreaWidgetContents_5->setFixedHeight(ui->scrollArea_5->height() +10); 702 | connect(ui->scrollArea_5->verticalScrollBar(),&QScrollBar::valueChanged,this,&Pixiv::Scroll_5_Bar_Down); 703 | int page = 1; 704 | for (int i = 0;i < 3;i++){ 705 | PicContent l; 706 | All_Pics->allPic_tag->push_back(l); 707 | } 708 | while (page <= 3) 709 | { 710 | QTextCodec *utf8 = QTextCodec::codecForName("utf-8"); 711 | QByteArray encoded = utf8->fromUnicode(QString::fromUtf8(word.toUtf8())).toPercentEncoding(); 712 | QString base_url = "https://pixiviz.pwp.app/api/v1/illust/search?word=" + QString(encoded); 713 | QString url = base_url + "&page=" + QString::number(page); 714 | QNetworkAccessManager *manager = new QNetworkAccessManager; 715 | connect(manager,&QNetworkAccessManager::finished,[=](QNetworkReply* reply)mutable{ 716 | int true_page = page - 1; 717 | Oset* tagPic = All_Pics->allPic_tag; 718 | QByteArray content = reply->readAll(); 719 | QJsonDocument doc = QJsonDocument::fromJson(content); 720 | QJsonObject obj = doc.object(); 721 | 722 | QJsonArray AtPics = obj.value("illusts").toArray(); 723 | if (AtPics.size() == 0){ 724 | return; 725 | } 726 | if (AtPics.size() > 0){ 727 | for (int l = 0;l < AtPics.size();l++){ 728 | DisPlay_PicContent k; 729 | tagPic->at(true_page).push_back(k); 730 | } 731 | } 732 | for (int i = 0;i < AtPics.size();i++){ 733 | if (All_Pics->stop_tag == true){ 734 | return; 735 | } 736 | QNetworkAccessManager *manager_2 = new QNetworkAccessManager; 737 | QString url = ChanHost(AtPics.at(i).toObject().value("image_urls").toObject().value("medium").toString(),FIRST_HOST); 738 | request->setUrl(QUrl(ChanHost(url,FIRST_HOST))); 739 | request->setRawHeader("referer","https://www.pixiv.net"); 740 | manager_2->get(*request); 741 | connect(manager_2, &QNetworkAccessManager::finished, [=](QNetworkReply *replys){ 742 | if (All_Pics->stop_tag == true){ 743 | return; 744 | } 745 | QByteArray content = replys->readAll(); 746 | QImage image; 747 | image.loadFromData(content); 748 | tagPic->at(true_page).at(i).value = true; 749 | tagPic->at(true_page).at(i).image = Radius(image,15).toImage(); 750 | tagPic->at(true_page).at(i).title = AtPics.at(i).toObject().value("title").toString(); 751 | tagPic->at(true_page).at(i).page_count = QString::number(AtPics.at(i).toObject().value("page_count").toInt()); 752 | QJsonObject newobj; 753 | newobj.insert("illust",AtPics.at(i).toObject()); 754 | QByteArray byte = QJsonDocument(newobj).toJson(QJsonDocument::Compact); 755 | tagPic->at(true_page).at(i).content = byte; 756 | 757 | replys->deleteLater(); 758 | }); 759 | } 760 | reply->deleteLater(); 761 | }); 762 | //发出请求 763 | request->setUrl(QUrl(url)); 764 | request->setRawHeader("Referer","https://pixiviz.pwp.app/search/" + encoded); 765 | manager->get(*request); 766 | page++; 767 | } 768 | } 769 | 770 | QString Setting::GetPicQuality(){ 771 | 772 | QString quality = ""; 773 | switch (PicQuality) { 774 | case 0: 775 | quality = "square_medium"; 776 | break; 777 | case 1: 778 | quality = "medium"; 779 | break; 780 | case 2: 781 | quality = "large"; 782 | break; 783 | } 784 | return quality; 785 | } 786 | //画师下一张滚动插画 787 | void Pixiv::Scroll_3_Bar_Down(int yUp){ 788 | PutPicInScroll(ScrollDisPlay::ART,ui->scrollAreaWidgetContents_3,491,450,400,yUp); 789 | } 790 | //排行榜下一张滚动插画 791 | void Pixiv::Scroll_4_Bar_Down(int yUp){ 792 | PutPicInScroll(ScrollDisPlay::RANK,ui->scrollAreaWidgetContents_4,491,450,400,yUp); 793 | } 794 | //tag下一张滚动插画 795 | void Pixiv::Scroll_5_Bar_Down(int yUp){ 796 | PutPicInScroll(ScrollDisPlay::TAG,ui->scrollAreaWidgetContents_5,491,450,400,yUp); 797 | } 798 | 799 | int Pixiv::GetLargestY(QWidget *scrollContent){ 800 | QObjectList children = scrollContent->children(); 801 | int Large = 0; 802 | for (int i = 0;i < children.size();i++){ 803 | int y = qobject_cast(children.at(i))->pos().y() + qobject_cast(children.at(i))->height(); 804 | Large = y > Large ? y : Large; 805 | } 806 | return Large; 807 | } 808 | 809 | void Pixiv::PutPicInScroll(ScrollDisPlay::PicType pictype,QWidget*scrollContent,int x,int _width,int _height,int yUp){ 810 | QWidget *area = qobject_cast(scrollContent->parent()); 811 | if (yUp + area->height() == scrollContent->height()){ 812 | int y = GetLargestY(scrollContent) + 10; 813 | DisPlay_PicContent now; 814 | bool can = All_Pics->GetFrontPic(&now,pictype); 815 | if (!can)return; 816 | QImage image = now.image; 817 | Mylabel* label = new Mylabel(scrollContent); 818 | QByteArray content = now.content; 819 | connect(label,&Mylabel::clicked,[=](){ 820 | ui->tabWidget->setCurrentIndex(1); 821 | QByteArray contents = content; 822 | qDebug() << contents.size(); 823 | disconnect(this, SIGNAL(Requestover(QByteArray&)),0,0);//清空Requestover的所有槽 824 | connect(this,SIGNAL(Requestover(QByteArray&)),this,SLOT(DealSearchContent(QByteArray&))); 825 | emit Requestover(contents); 826 | 827 | }); 828 | int width = image.width(),height = image.height(); 829 | double times = 1; 830 | while(width > _width || height > _height){ 831 | times += 0.1; 832 | width = image.width() / times; 833 | height = image.height() / times; 834 | } 835 | label->setFixedWidth(width); 836 | label->setFixedHeight(height); 837 | label->SetName(now.title); 838 | label->SetPage(now.page_count); 839 | label->Seteffect(); 840 | label->setCursor(Qt::PointingHandCursor); 841 | label->setStyleSheet("border: 2px solid #808080;border-radius: 15px;"); 842 | label->setPixmap(QPixmap::fromImage(image)); 843 | label->setScaledContents(true); 844 | if (y >= area->height() - 10) 845 | scrollContent->setMinimumHeight(y + label->height() + 30); 846 | label->move(x / 2 - width / 2,y); 847 | label->show(); 848 | } 849 | } 850 | 851 | void Pixiv::cleanLast(QWidget * scrollContent){ 852 | QListlabels = scrollContent->findChildren(); 853 | foreach (Mylabel* label, labels) { 854 | if (!label)continue; 855 | label->setParent(nullptr); 856 | delete label; 857 | } 858 | } 859 | -------------------------------------------------------------------------------- /Pixiv1.6/pixiv.h: -------------------------------------------------------------------------------- 1 | #ifndef PIXIV_H 2 | #define PIXIV_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "mylabel.h" 9 | 10 | QT_BEGIN_NAMESPACE 11 | namespace Ui { class Pixiv; } 12 | QT_END_NAMESPACE 13 | 14 | struct DisPlay_PicContent{ 15 | QImage image; 16 | QString title = ""; 17 | QString page_count = "0"; 18 | QByteArray content = ""; 19 | bool value = false; 20 | 21 | }; 22 | typedef std::vector PicContent; 23 | typedef std::vector Oset; 24 | typedef Oset::iterator Oset_iter; 25 | typedef PicContent::iterator PicContent_iter; 26 | class ScrollDisPlay{ 27 | public: 28 | enum PicType{ 29 | ART,RANK,TAG 30 | }; 31 | Oset*allPic_art = new Oset; 32 | Oset*allPic_rank = new Oset; 33 | Oset*allPic_tag = new Oset; 34 | bool stop_art = true; 35 | bool stop_rank = true; 36 | bool stop_tag = true; 37 | void Clean(PicType type){ 38 | Oset*nowPic = GetAllPic(type); 39 | nowPic->clear(); 40 | } 41 | Oset* GetAllPic(PicType allpic){ 42 | Oset*nowPic = nullptr; 43 | switch (allpic) { 44 | case ART:{ 45 | nowPic = allPic_art; 46 | break; 47 | } 48 | case RANK:{ 49 | nowPic = allPic_rank; 50 | break; 51 | } 52 | case TAG:{ 53 | nowPic = allPic_tag; 54 | break; 55 | } 56 | } 57 | return nowPic; 58 | } 59 | bool GetFrontPic(DisPlay_PicContent *mine,PicType allpic){ 60 | Oset*nowPic = GetAllPic(allpic); 61 | if (nowPic->size() == 0)return false; 62 | for (Oset_iter it = nowPic->begin();it != nowPic->end();it++){ 63 | if (it->size() > 0){ 64 | if (it->begin()->value == false)return false; 65 | *mine = *(it->begin()); 66 | it->erase(it->begin()); 67 | return true; 68 | } 69 | } 70 | return false; 71 | 72 | } 73 | }; 74 | 75 | typedef std::vectorDisplay; 76 | typedef const QString SOFTWARE_VERSION; 77 | 78 | class Pixiv : public QMainWindow 79 | { 80 | Q_OBJECT 81 | 82 | public: 83 | //处理label资源 84 | void inline static cleanLast(QWidget * scrollContent); 85 | int inline GetLargestY(QWidget *); 86 | void inline PutPicInScroll(ScrollDisPlay::PicType,QWidget*,int x,int width,int height,int yUp); 87 | QPixmap static Radius(QImage &pic,int radius); 88 | void print(QString info); 89 | QNetworkRequest *request; 90 | QNetworkAccessManager *m_accessManager; 91 | Pixiv(QWidget *parent = nullptr); 92 | ~Pixiv(); 93 | signals: 94 | void finished(QNetworkReply*);//发送接收信号 95 | void Requestover(QByteArray&); 96 | void DownOriginal(QString); 97 | void StartSearchPic(QString id);//开始爬取插画 98 | void StartSearchArt(QString id);//开始爬取画师 99 | void StartSearchRank(QString mode,QString time);//开始爬取排行榜 100 | void StartSearchTag(QString word);//开始爬取搜索内容 101 | private slots: 102 | void Scroll_5_Bar_Down(int yUp); 103 | void Scroll_3_Bar_Down(int yUp); 104 | void Scroll_4_Bar_Down(int yUp); 105 | void TagSearch(QString word);//搜索内容 106 | void rank(QString mode,QString time);//排行榜 107 | void finishedSlot(QNetworkReply* reply);//接收数据 108 | void DealSearchContent(QByteArray& content);//解析接收到的数据(插画) 109 | void DealAritcleContent(QByteArray& content);//解析接收到的数据(画师) 110 | void DealRadomPic(QByteArray& content);//处理随机图片 111 | void PicClicked(QString id);//爬取插画 112 | void ArticleClicked(QString id);//画师ID 113 | void on_toolButton_clicked(); 114 | void on_toolButton_2_clicked(); 115 | void on_toolButton_3_clicked(); 116 | void on_toolButton_4_clicked(); 117 | void on_liulan_clicked(); 118 | void on_textEdit_textChanged(); 119 | void on_pushButton_2_clicked(); 120 | 121 | private: 122 | Ui::Pixiv *ui; 123 | }; 124 | 125 | QString ChanHost(QString url,const QString hosts);//换HOST 126 | void ReadSetting();//读取设置 127 | QString GetTime();//获取当前时间 128 | 129 | class Setting{ 130 | public: 131 | QString GetPicQuality(); 132 | QString path = "./"; 133 | bool R18 = false; 134 | int PicQuality = 0; 135 | bool rankAuto = false; 136 | }; 137 | //图片类 138 | class ImgInfo{ 139 | private: 140 | unsigned int status_code = 0; 141 | unsigned int page_count = 0; 142 | unsigned long PicID = 0; 143 | unsigned long UserID = 0; 144 | QString UserName = "",PicName = ""; 145 | public: 146 | ImgInfo(){ 147 | status_code = 0;page_count = 0;PicID = 0;UserID = 0;QString UserName = ""; 148 | PicName = ""; 149 | } 150 | void clear(){ 151 | status_code = 0;page_count = 0;PicID = 0;UserID = 0;QString UserName = ""; 152 | PicName = ""; 153 | original.clear(); 154 | square_medium.clear(); 155 | } 156 | ImgInfo(unsigned status_code_, 157 | unsigned int page_count_, 158 | unsigned long PicID_, 159 | unsigned long UserID_, 160 | 161 | QString UserName_, 162 | QString PicName_ 163 | ){ 164 | status_code = status_code_; 165 | page_count = page_count_; 166 | PicID = PicID_; 167 | UserID = UserID_; 168 | 169 | UserName = UserName_; 170 | PicName = PicName_; 171 | } 172 | std::vectorsquare_medium; 173 | std::vectororiginal; 174 | void PushAUrlToMedium(QString url){ 175 | square_medium.push_back(url); 176 | } 177 | void PushAUrlToOrigin(QString url){ 178 | original.push_back(url); 179 | } 180 | unsigned int GetStatus_code() const{ 181 | return status_code; 182 | } 183 | unsigned int GetPage_count() const{ 184 | return page_count; 185 | } 186 | unsigned long GetPicID() const{ 187 | return PicID; 188 | } 189 | unsigned long GetUserID() const{ 190 | return UserID; 191 | } 192 | QString GetUserName() const{ 193 | return UserName; 194 | } 195 | QString GetPicName() const{ 196 | return PicName; 197 | } 198 | 199 | void SetStatus_code(unsigned status_code_){ 200 | status_code = status_code_; 201 | } 202 | void SetPage_count(unsigned Page_count_){ 203 | page_count = Page_count_; 204 | } 205 | void SetPicID(unsigned long PicID_){ 206 | PicID = PicID_; 207 | } 208 | void SetUserID(unsigned long UserID_){ 209 | UserID = UserID_; 210 | } 211 | void SetUserName(QString UserName_){ 212 | UserName = UserName_; 213 | } 214 | void SetPicName(QString PicName_){ 215 | PicName = PicName_; 216 | } 217 | }; 218 | 219 | #endif // PIXIV_H 220 | -------------------------------------------------------------------------------- /Pixiv1.6/pixiv.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pixiv 4 | 5 | 6 | 7 | 0 8 | 0 9 | 500 10 | 600 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 500 22 | 600 23 | 24 | 25 | 26 | Pixiv 27 | 28 | 29 | 30 | 31 | 32 | 0 33 | 0 34 | 498 35 | 571 36 | 37 | 38 | 39 | 40 | 41 | 42 | 0 43 | 44 | 45 | 46 | 搜索 47 | 48 | 49 | 50 | 51 | 10 52 | 140 53 | 101 54 | 31 55 | 56 | 57 | 58 | PointingHandCursor 59 | 60 | 61 | 查找 62 | 63 | 64 | 65 | 66 | 67 | 120 68 | 140 69 | 191 70 | 31 71 | 72 | 73 | 74 | 75 | 76 | 77 | 320 78 | 140 79 | 121 80 | 31 81 | 82 | 83 | 84 | PointingHandCursor 85 | 86 | 87 | 88 | 插画ID 89 | 90 | 91 | 92 | 93 | 画师ID 94 | 95 | 96 | 97 | 98 | 插画标题 99 | 100 | 101 | 102 | 103 | 104 | 105 | 10 106 | 180 107 | 101 108 | 31 109 | 110 | 111 | 112 | PointingHandCursor 113 | 114 | 115 | 随机插画 116 | 117 | 118 | 119 | 120 | 121 | 10 122 | 220 123 | 481 124 | 301 125 | 126 | 127 | 128 | font: 10pt "黑体"; 129 | 130 | 131 | 132 | Qt::ScrollBarAlwaysOn 133 | 134 | 135 | Qt::ScrollBarAlwaysOn 136 | 137 | 138 | QTextEdit::NoWrap 139 | 140 | 141 | 142 | 143 | 144 | 10 145 | 10 146 | 471 147 | 121 148 | 149 | 150 | 151 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 152 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 153 | p, li { white-space: pre-wrap; } 154 | </style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> 155 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Pixiv 小工具 v1.6 (基于Qt开发)</span></p> 156 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">输入你要查找的插画Id或者画师id,然后选择搜索类型,点查找即可。</span></p> 157 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">注意:不会自动跳转到对应页,请手动切换</span></p> 158 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">By Ealodi</span></p> 159 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">吾爱:</span><span style=" color:#008000;">https://www.52pojie.cn/home.php?mod=space&amp;uid=1611144</span></p></body></html> 160 | 161 | 162 | 163 | 164 | 165 | 插画 166 | 167 | 168 | 169 | 170 | 0 171 | 0 172 | 491 173 | 561 174 | 175 | 176 | 177 | 178 | 0 179 | 0 180 | 181 | 182 | 183 | Qt::ScrollBarAsNeeded 184 | 185 | 186 | Qt::ScrollBarAlwaysOff 187 | 188 | 189 | true 190 | 191 | 192 | 193 | 194 | 0 195 | 0 196 | 491 197 | 559 198 | 199 | 200 | 201 | 202 | 491 203 | 558 204 | 205 | 206 | 207 | 208 | 209 | 10 210 | 20 211 | 61 212 | 31 213 | 214 | 215 | 216 | 插画ID: 217 | 218 | 219 | 220 | 221 | 222 | 240 223 | 20 224 | 71 225 | 31 226 | 227 | 228 | 229 | 插画名称: 230 | 231 | 232 | 233 | 234 | 235 | 10 236 | 60 237 | 61 238 | 31 239 | 240 | 241 | 242 | 画师ID: 243 | 244 | 245 | 246 | 247 | 248 | 240 249 | 60 250 | 71 251 | 31 252 | 253 | 254 | 255 | 画师名称: 256 | 257 | 258 | 259 | 260 | 261 | 10 262 | 100 263 | 71 264 | 31 265 | 266 | 267 | 268 | 插画页数: 269 | 270 | 271 | 272 | 273 | 274 | 10 275 | 160 276 | 81 277 | 31 278 | 279 | 280 | 281 | PointingHandCursor 282 | 283 | 284 | 下载 285 | 286 | 287 | 288 | 289 | 290 | 90 291 | 20 292 | 141 293 | 31 294 | 295 | 296 | 297 | background-color:transparent; 298 | border-width:0;border-style:outset; 299 | font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 300 | 301 | 302 | 303 | 304 | 305 | 320 306 | 20 307 | 141 308 | 31 309 | 310 | 311 | 312 | background-color:transparent; 313 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 314 | 315 | 316 | 317 | 318 | 319 | 90 320 | 60 321 | 141 322 | 31 323 | 324 | 325 | 326 | background-color:transparent; 327 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 328 | 329 | 330 | 331 | 332 | 333 | 320 334 | 60 335 | 141 336 | 31 337 | 338 | 339 | 340 | background-color:transparent; 341 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 342 | 343 | 344 | 345 | 346 | 347 | 90 348 | 100 349 | 101 350 | 31 351 | 352 | 353 | 354 | background-color:transparent; 355 | border-width:0;border-style:outset;font-family: 黑体;text-align: center;color: #da7a85;font-weight: 600;font-size: 20px; 356 | 357 | 358 | 359 | 360 | 361 | 100 362 | 170 363 | 331 364 | 21 365 | 366 | 367 | 368 | 0 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 画师 377 | 378 | 379 | 380 | 381 | 0 382 | 0 383 | 491 384 | 561 385 | 386 | 387 | 388 | 389 | 0 390 | 0 391 | 392 | 393 | 394 | Qt::ScrollBarAsNeeded 395 | 396 | 397 | Qt::ScrollBarAlwaysOff 398 | 399 | 400 | true 401 | 402 | 403 | 404 | 405 | 0 406 | 0 407 | 491 408 | 559 409 | 410 | 411 | 412 | 413 | 491 414 | 558 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 查找tag 423 | 424 | 425 | 426 | 427 | 0 428 | 0 429 | 491 430 | 561 431 | 432 | 433 | 434 | 435 | 0 436 | 0 437 | 438 | 439 | 440 | Qt::ScrollBarAsNeeded 441 | 442 | 443 | Qt::ScrollBarAlwaysOff 444 | 445 | 446 | true 447 | 448 | 449 | 450 | 451 | 0 452 | 0 453 | 491 454 | 559 455 | 456 | 457 | 458 | 459 | 491 460 | 558 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 排行榜 469 | 470 | 471 | 472 | 473 | 0 474 | 0 475 | 491 476 | 561 477 | 478 | 479 | 480 | 481 | 0 482 | 0 483 | 484 | 485 | 486 | Qt::ScrollBarAsNeeded 487 | 488 | 489 | Qt::ScrollBarAlwaysOff 490 | 491 | 492 | true 493 | 494 | 495 | 496 | 497 | 0 498 | 0 499 | 491 500 | 600 501 | 502 | 503 | 504 | 505 | 491 506 | 600 507 | 508 | 509 | 510 | 511 | 512 | 50 513 | 20 514 | 110 515 | 22 516 | 517 | 518 | 519 | 520 | 0 521 | 0 522 | 0 523 | 2020 524 | 1 525 | 1 526 | 527 | 528 | 529 | yyyy-M-d 530 | 531 | 532 | 533 | 534 | 535 | 10 536 | 20 537 | 41 538 | 22 539 | 540 | 541 | 542 | 日期: 543 | 544 | 545 | 546 | 547 | 548 | 270 549 | 20 550 | 51 551 | 22 552 | 553 | 554 | 555 | PointingHandCursor 556 | 557 | 558 | 确定 559 | 560 | 561 | 562 | 563 | 564 | 170 565 | 20 566 | 87 567 | 22 568 | 569 | 570 | 571 | PointingHandCursor 572 | 573 | 574 | 575 | 日榜 576 | 577 | 578 | 579 | 580 | 周榜 581 | 582 | 583 | 584 | 585 | 月榜 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 设置 595 | 596 | 597 | 598 | 599 | 0 600 | 0 601 | 491 602 | 561 603 | 604 | 605 | 606 | 607 | 0 608 | 0 609 | 610 | 611 | 612 | Qt::ScrollBarAsNeeded 613 | 614 | 615 | Qt::ScrollBarAlwaysOff 616 | 617 | 618 | true 619 | 620 | 621 | 622 | 623 | 0 624 | 0 625 | 491 626 | 600 627 | 628 | 629 | 630 | 631 | 491 632 | 600 633 | 634 | 635 | 636 | 637 | 638 | 0 639 | 0 640 | 271 641 | 41 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 保存路径: 652 | 653 | 654 | 655 | 656 | 657 | 658 | PointingHandCursor 659 | 660 | 661 | ... 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 0 671 | 40 672 | 221 673 | 81 674 | 675 | 676 | 677 | 678 | 679 | 680 | 随机插画开启R18: 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 预览插画质量: 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 启动自行加载排行榜: 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 390 737 | 10 738 | 61 739 | 31 740 | 741 | 742 | 743 | PointingHandCursor 744 | 745 | 746 | 保存 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 0 758 | 0 759 | 500 760 | 26 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pixild 2 | --------------------------------------------------------------------------------