#1 1.0.2 gui功能

Open
lyq wants to merge 3 commits from lyq/feature/pyqt-ui into lyq/master

+ 2 - 2
.gitignore

@@ -1,2 +1,2 @@
-/build
-*.pyc
+/build
+*.pyc

+ 20 - 20
README.md

@@ -1,20 +1,20 @@
-# crawl_baidu
-
-百度指数爬虫工具
-
-## Screenshot
-
-![](docs/images/BaiduHi_2022-6-29_0-44-51.jpg)
-
-## Usage
-
-1、配置 `conf/config.json` 文件
-
-    words:需要查询什么指数
-    cookie:登录百度帐户,浏览器F12,复制
-    CliperText:
-
-![](docs/images//BaiduHi_2022-6-29_0-43-15.jpg)
-
-2、双击exe即可
-
+# crawl_baidu
+
+百度指数爬虫工具
+
+## Screenshot
+
+![](docs/images/BaiduHi_2022-6-29_0-44-51.jpg)
+
+## Usage
+
+1、配置 `conf/config.json` 文件
+
+    words:需要查询什么指数
+    cookie:登录百度帐户,浏览器F12,复制
+    CliperText:
+
+![](docs/images//BaiduHi_2022-6-29_0-43-15.jpg)
+
+2、双击exe即可
+

+ 6 - 0
bin/crawl_baidu

@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+import crawl_baidu
+
+if __name__ == '__main__':
+    crawl_baidu.main()

+ 11 - 11
conf/config.json

@@ -1,12 +1,12 @@
-{
-    "cookie": "BIDUPSID=94CF38B6E2B133BB95CFD7692279A2E1; PSTM=1656423206; BA_HECTOR=0l8l8g252kag0kal201hbm0p715; ZFY=T8w70A:ACckELtYIsYWBHLbsz7sugWUFeW3MhaAA1ojU:C; BDUSS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; H_PS_PSSID=36555_36461_36501_36455_36414_36690_36167_36695_36697_36622_26350_36467_22159; BAIDUID=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; BAIDUID_BFESS=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; bdindexid=a17n716aovv6sp31nffonloj57; RT=\"z=1&dm=baidu.com&si=lw6v60mezv8&ss=l4y7n19q&sl=b&tt=a43&bcn=https://fclog.baidu.com/log/weirwood?type=perf\"; BDUSS_BFESS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; ab_sr=1.0.1_NWY1MTE0ZTBiNWU4ZGFlNTQwMWU2NWEzYTRhYTEzZGMyMjI0NWZiY2EwNTUzZjg2NjMzM2I5Y2FjYzYxOTQ0ZDM5YTY1MzExMzk0NmE0ODRmNjM2NzdjNDJjZGYyYmUyMmUzZjRlYTcwMDkyYTVmNmNiMTlkNzhlNmRlOGI3N2RiZWQwOTVkNTQ1OTNkNThkNzQ2NjU3ZmY0MTQ1ZmFmNA==",
-    "CliperText": "1656399607736_1656431430319_4AB9QFVS9yPO/04xkfvTZwBTR5dvR0vc288+m8IVjlgN8bMIpU6QuC2bRux22CB2Nbng1A6MN7m8IX2FO6oF15RHawNhPCcwq4Mw3QS9dBt7F9xmt4Dgk58vhHOe5x0mM54r6A4ynFeQusA66u5tdjDf15Di88ToI9hMKhcoVN+nItCTH7oEvHXKzf2R8DIwu0QcCyWgcQl4cdjq/Dg6doApJ0uejKu+ptYHJSEBLtEfQm98gTv/fOcvYcfJKYDmKQFDg3Eso9n6By/2bWBSkZIm+1gOW+80Cy448DaLJPvxso9NGiqElawftwr2kdWrqNRGDepgI5gKFpTea6SJ6Jofg/R/lWGUR76IXhlnitvurTY55t3Sli64QRxux7SUL1ghVwQln9SjlD1o4TuNskX7D6fW5d7lqXluc+KtxpeSwQtnQvgYE0cb9smSubzF7jPvkAyY3qFOKDW2eTzU6Q==",
-    "words": [
-        [
-            {
-                "name": "气候变化",
-                "wordType": 1
-            }
-        ]
-    ]
+{
+    "cookie": "BIDUPSID=94CF38B6E2B133BB95CFD7692279A2E1; PSTM=1656423206; BA_HECTOR=0l8l8g252kag0kal201hbm0p715; ZFY=T8w70A:ACckELtYIsYWBHLbsz7sugWUFeW3MhaAA1ojU:C; BDUSS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; H_PS_PSSID=36555_36461_36501_36455_36414_36690_36167_36695_36697_36622_26350_36467_22159; BAIDUID=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; BAIDUID_BFESS=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; bdindexid=a17n716aovv6sp31nffonloj57; RT=\"z=1&dm=baidu.com&si=lw6v60mezv8&ss=l4y7n19q&sl=b&tt=a43&bcn=https://fclog.baidu.com/log/weirwood?type=perf\"; BDUSS_BFESS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; ab_sr=1.0.1_NWY1MTE0ZTBiNWU4ZGFlNTQwMWU2NWEzYTRhYTEzZGMyMjI0NWZiY2EwNTUzZjg2NjMzM2I5Y2FjYzYxOTQ0ZDM5YTY1MzExMzk0NmE0ODRmNjM2NzdjNDJjZGYyYmUyMmUzZjRlYTcwMDkyYTVmNmNiMTlkNzhlNmRlOGI3N2RiZWQwOTVkNTQ1OTNkNThkNzQ2NjU3ZmY0MTQ1ZmFmNA==",
+    "CliperText": "1656399607736_1656431430319_4AB9QFVS9yPO/04xkfvTZwBTR5dvR0vc288+m8IVjlgN8bMIpU6QuC2bRux22CB2Nbng1A6MN7m8IX2FO6oF15RHawNhPCcwq4Mw3QS9dBt7F9xmt4Dgk58vhHOe5x0mM54r6A4ynFeQusA66u5tdjDf15Di88ToI9hMKhcoVN+nItCTH7oEvHXKzf2R8DIwu0QcCyWgcQl4cdjq/Dg6doApJ0uejKu+ptYHJSEBLtEfQm98gTv/fOcvYcfJKYDmKQFDg3Eso9n6By/2bWBSkZIm+1gOW+80Cy448DaLJPvxso9NGiqElawftwr2kdWrqNRGDepgI5gKFpTea6SJ6Jofg/R/lWGUR76IXhlnitvurTY55t3Sli64QRxux7SUL1ghVwQln9SjlD1o4TuNskX7D6fW5d7lqXluc+KtxpeSwQtnQvgYE0cb9smSubzF7jPvkAyY3qFOKDW2eTzU6Q==",
+    "words": [
+        [
+            {
+                "name": "气候变化",
+                "wordType": 1
+            }
+        ]
+    ]
 }

+ 118 - 0
conf/configure_window.ui

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>546</width>
+    <height>223</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>60</y>
+      <width>54</width>
+      <height>12</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Cookie:</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_2">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>90</y>
+      <width>54</width>
+      <height>12</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Cookie:</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_3">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>120</y>
+      <width>54</width>
+      <height>12</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>关键词:</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="btnCrawlBaidu">
+    <property name="geometry">
+     <rect>
+      <x>240</x>
+      <y>160</y>
+      <width>75</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>运行</string>
+    </property>
+   </widget>
+   <widget class="QWidget" name="layoutWidget">
+    <property name="geometry">
+     <rect>
+      <x>100</x>
+      <y>40</y>
+      <width>391</width>
+      <height>111</height>
+     </rect>
+    </property>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <widget class="QLineEdit" name="lineEdit"/>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="lineEdit_2"/>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="lineEdit_3"/>
+     </item>
+    </layout>
+   </widget>
+   <widget class="QLabel" name="label_4">
+    <property name="geometry">
+     <rect>
+      <x>60</x>
+      <y>20</y>
+      <width>251</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>抓取百度指数</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>546</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 18 - 5
crawl_baidu/__init__.py

@@ -1,5 +1,18 @@
-from crawl_baidu.crawl_baidu import CrawlBaidu
-
-def main():
-    crawl=CrawlBaidu()
-    crawl.get_index_data()
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2022/06/29 12:40:58
+@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
+@Desc    :   pyqt ui
+'''
+
+from PyQt5.QtWidgets import QApplication
+from crawl_baidu.pages.configure_window import ConfigureWindow
+
+def main():
+    app=QApplication([])
+    win=ConfigureWindow()
+    app.exec()
+    # crawl=CrawlBaidu()
+    # crawl.get_index_data()

+ 3 - 3
crawl_baidu/api.py

@@ -1,3 +1,3 @@
-
-_host = r"https://index.baidu.com"
-search = _host + r'/api/SearchApi/index?area=0&word={}&area=0&startDate={}&endDate={}'
+
+_host = r"https://index.baidu.com"
+search = _host + r'/api/SearchApi/index?area=0&word={}&area=0&startDate={}&endDate={}'

+ 92 - 92
crawl_baidu/crawl_baidu.py

@@ -1,93 +1,93 @@
-
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@Contact :   liuyuqi.gov@msn.cn
-@Time    :   2022/06/28 23:15:05
-@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
-@Desc    :   
-'''
-
-from http import cookies
-import requests
-import sys,os,json
-from crawl_baidu.lib.json_conf import JsonConf
-import time
-headers = {
-    'Accept': 'application/json, text/plain, */*',
-    'Accept-Encoding': 'gzip, deflate',
-    'Accept-Language': 'zh-CN,zh;q=0.9',
-    'Cache-Control': 'no-cache',
-    'DNT': '1',
-    'Host': 'index.baidu.com',
-    'Pragma': 'no-cache',
-    'Proxy-Connection': 'keep-alive',
-    'Referer': 'https://index.baidu.com/v2/main/index.html',
-    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36',
-    'X-Requested-With': 'XMLHttpRequest',
-}
-
-class CrawlBaidu():
-    def __init__(self):
-        self.sess=requests.Session()
-        self.jsonConf = JsonConf()
-        self.conf = self.jsonConf.load()
-        cookie = self.conf.get('cookie')
-        CliperText = self.conf.get('CliperText')
-        self.words = self.conf.get('words')
-        # self.sess.cookies.update(cookie)
-        self.sess.headers.update({
-            "Cipher-Text":CliperText,
-            "Cookie" : cookie
-            })
-
-    @staticmethod
-    def decrypt(t,e):
-        n = list(t)
-        i = list(e)
-        a = {}
-        result = []
-        ln = int(len(n)/2)
-        start = n[ln:]
-        end = n[:ln]
-        for j,k in zip(start, end):
-            a.update({k: j})
-        for j in e:
-            result.append(a.get(j))
-        return ''.join(result)
-        
-    def get_ptbk(self,uniqid):
-        url = 'http://index.baidu.com/Interface/ptbk?uniqid={}'
-        resp = self.sess.get(url.format(uniqid), headers=headers)
-        if resp.status_code != 200:
-            print('获取uniqid失败')
-            sys.exit(1)
-        return resp.json().get('data')
-        
-    def get_index_data(self, start='2011-01-03', end='2022-08-05'):
-        keyword = str(self.words).replace("'", '"')
-        url = f'http://index.baidu.com/api/SearchApi/index?area=0&word={keyword}&area=0&startDate={start}&endDate={end}'
-        resp = self.sess.get(url, headers=headers)
-        if resp.status_code != 200:
-            print('获取指数失败')
-            sys.exit(1)
-
-        content = resp.json()
-        data = content.get('data')
-        user_indexes = data.get('userIndexes')[0]
-        uniqid = data.get('uniqid')
-        ptbk = self.get_ptbk(uniqid)
-
-        while ptbk is None or ptbk == '':
-            ptbk = self.get_ptbk(uniqid)
-
-        all_data = user_indexes.get('all').get('data')
-        result = CrawlBaidu.decrypt(ptbk, all_data)
-        result = result.split(',')
-
-        print(result)
-
-        if  not os.path.exists("data"):
-            os.mkdir("data")
-        with open("data/res.txt","w") as file:
+
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2022/06/28 23:15:05
+@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
+@Desc    :   
+'''
+
+from http import cookies
+import requests
+import sys,os,json
+from crawl_baidu.utils.json_conf import JsonConf
+import time
+headers = {
+    'Accept': 'application/json, text/plain, */*',
+    'Accept-Encoding': 'gzip, deflate',
+    'Accept-Language': 'zh-CN,zh;q=0.9',
+    'Cache-Control': 'no-cache',
+    'DNT': '1',
+    'Host': 'index.baidu.com',
+    'Pragma': 'no-cache',
+    'Proxy-Connection': 'keep-alive',
+    'Referer': 'https://index.baidu.com/v2/main/index.html',
+    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36',
+    'X-Requested-With': 'XMLHttpRequest',
+}
+
+class CrawlBaidu():
+    def __init__(self):
+        self.sess=requests.Session()
+        self.jsonConf = JsonConf()
+        self.conf = self.jsonConf.load()
+        cookie = self.conf.get('cookie')
+        CliperText = self.conf.get('CliperText')
+        self.words = self.conf.get('words')
+        # self.sess.cookies.update(cookie)
+        self.sess.headers.update({
+            "Cipher-Text":CliperText,
+            "Cookie" : cookie
+            })
+
+    @staticmethod
+    def decrypt(t,e):
+        n = list(t)
+        i = list(e)
+        a = {}
+        result = []
+        ln = int(len(n)/2)
+        start = n[ln:]
+        end = n[:ln]
+        for j,k in zip(start, end):
+            a.update({k: j})
+        for j in e:
+            result.append(a.get(j))
+        return ''.join(result)
+        
+    def get_ptbk(self,uniqid):
+        url = 'http://index.baidu.com/Interface/ptbk?uniqid={}'
+        resp = self.sess.get(url.format(uniqid), headers=headers)
+        if resp.status_code != 200:
+            print('获取uniqid失败')
+            sys.exit(1)
+        return resp.json().get('data')
+        
+    def get_index_data(self, start='2011-01-03', end='2022-08-05'):
+        keyword = str(self.words).replace("'", '"')
+        url = f'http://index.baidu.com/api/SearchApi/index?area=0&word={keyword}&area=0&startDate={start}&endDate={end}'
+        resp = self.sess.get(url, headers=headers)
+        if resp.status_code != 200:
+            print('获取指数失败')
+            sys.exit(1)
+
+        content = resp.json()
+        data = content.get('data')
+        user_indexes = data.get('userIndexes')[0]
+        uniqid = data.get('uniqid')
+        ptbk = self.get_ptbk(uniqid)
+
+        while ptbk is None or ptbk == '':
+            ptbk = self.get_ptbk(uniqid)
+
+        all_data = user_indexes.get('all').get('data')
+        result = CrawlBaidu.decrypt(ptbk, all_data)
+        result = result.split(',')
+
+        print(result)
+
+        if  not os.path.exists("data"):
+            os.mkdir("data")
+        with open("data/res.txt","w") as file:
             file.write(json.dumps(result))

+ 0 - 0
crawl_baidu/lib/__init__.py → crawl_baidu/pages/__init__.py


+ 94 - 0
crawl_baidu/pages/base_window.py

@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2023/03/16 01:29:59
+@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
+@Desc    :   base windows
+'''
+from PyQt5.QtWidgets import QMainWindow, QGraphicsDropShadowEffect
+from PyQt5.QtCore import Qt, QPropertyAnimation, QEasingCurve
+from PyQt5.QtGui import QColor
+
+class BaseWindow(QMainWindow):
+    '''主窗体'''
+
+    def mousePressEvent(self, event):
+        # 重写一堆方法使其支持拖动
+        if event.button() == Qt.LeftButton:
+            self.m_drag = True
+            self.m_DragPosition = event.globalPos() - self.pos()
+            event.accept()
+
+    def mouseMoveEvent(self, QMouseEvent):
+        try:
+            if Qt.LeftButton and self.m_drag:
+                self.move(QMouseEvent.globalPos() - self.m_DragPosition)
+                QMouseEvent.accept()
+        except:
+            pass
+
+    def mouseReleaseEvent(self, QMouseEvent):
+        self.m_drag = False
+
+    def _frame(self):
+        # 边框
+        self.setWindowFlags(Qt.FramelessWindowHint)
+        self.setAttribute(Qt.WA_TranslucentBackground, True)
+        # 阴影
+        effect = QGraphicsDropShadowEffect(blurRadius=12, xOffset=0, yOffset=0)
+        effect.setColor(QColor(25, 25, 25, 170))
+        # self.mainFrame.setGraphicsEffect(effect)
+
+    def doFadeIn(self):
+        # 动画
+        self.animation = QPropertyAnimation(self, b'windowOpacity')
+        # 持续时间250ms
+        self.animation.setDuration(250)
+        try:
+            # 尝试先取消动画完成后关闭窗口的信号
+            self.animation.finished.disconnect(self.close)
+        except:
+            pass
+        self.animation.stop()
+        # 透明度范围从0逐渐增加到1
+        self.animation.setEasingCurve(QEasingCurve.InOutCubic)
+        self.animation.setStartValue(0)
+        self.animation.setEndValue(1)
+        self.animation.start()
+
+    def doFadeOut(self):
+        self.animation.stop()
+        # 动画完成则关闭窗口
+        self.animation.finished.connect(self.close)
+        # 透明度范围从1逐渐减少到0s
+        self.animation.setEasingCurve(QEasingCurve.InOutCubic)
+        self.animation.setStartValue(1)
+        self.animation.setEndValue(0)
+        self.animation.start()
+
+    def setWarninginfo(self, text):
+        self.lab_info.setStyleSheet("""
+            .QLabel {
+                border:1px solid #ffccc7;
+                border-radius:3px;
+                line-height: 140px;
+                padding: 5px;
+                color: #434343;
+                background: #fff2f0;
+            }
+            """)
+        self.lab_info.setText(text)
+
+    def setSuccessinfo(self, text):
+        self.lab_info.setStyleSheet("""
+            .QLabel {
+                border:1px solid #b7eb8f;
+                border-radius:3px;
+                line-height: 140px;
+                padding: 5px;
+                color: #434343;
+                background: #f6ffed;
+            }
+            """)
+        self.lab_info.setText(text)

+ 36 - 0
crawl_baidu/pages/configure_window.py

@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2023/03/16 01:29:59
+@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
+@Desc    :   configure windows
+'''
+
+from crawl_baidu.pages.base_window import BaseWindow
+from PyQt5.uic import loadUi
+
+class ConfigureWindow(BaseWindow):
+    '''配置窗口,主窗口'''
+    config = {}
+    def __init__(self):
+        super().__init__()
+        loadUi("./conf/configure_window.ui", self)
+        # self._frame()
+        # self._eventfilter()
+        # self.doFadeIn()
+        self.config_exists = True
+
+        # 判断配置文件是否存在
+        # if not os.path.exists(working_dir + "/config.json"):
+        #     self.setWarninginfo("配置文件不存在!请单击“设置”创建配置文件")
+        #     self.config_exists = False
+
+        self.show()
+        
+    def saveConf(self):
+        self.updateConfig()
+        self.doFadeOut()
+
+    def updateConfig():
+        pass

+ 0 - 0
crawl_baidu/utils/__init__.py


+ 0 - 0
crawl_baidu/lib/json_conf.py → crawl_baidu/utils/json_conf.py


+ 0 - 0
crawl_baidu/lib/yml_conf.py → crawl_baidu/utils/yml_conf.py


+ 0 - 44
demo.spec

@@ -1,44 +0,0 @@
-# -*- mode: python ; coding: utf-8 -*-
-
-
-block_cipher = None
-
-
-a = Analysis(
-    ['demo.py'],
-    pathex=[],
-    binaries=[],
-    datas=[],
-    hiddenimports=[],
-    hookspath=[],
-    hooksconfig={},
-    runtime_hooks=[],
-    excludes=[],
-    win_no_prefer_redirects=False,
-    win_private_assemblies=False,
-    cipher=block_cipher,
-    noarchive=False,
-)
-pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
-
-exe = EXE(
-    pyz,
-    a.scripts,
-    a.binaries,
-    a.zipfiles,
-    a.datas,
-    [],
-    name='demo',
-    debug=False,
-    bootloader_ignore_signals=False,
-    strip=False,
-    upx=True,
-    upx_exclude=[],
-    runtime_tmpdir=None,
-    console=True,
-    disable_windowed_traceback=False,
-    argv_emulation=False,
-    target_arch=None,
-    codesign_identity=None,
-    entitlements_file=None,
-)

+ 11 - 11
dist/conf/config.json

@@ -1,12 +1,12 @@
-{
-    "cookie": "BIDUPSID=94CF38B6E2B133BB95CFD7692279A2E1; PSTM=1656423206; BA_HECTOR=0l8l8g252kag0kal201hbm0p715; ZFY=T8w70A:ACckELtYIsYWBHLbsz7sugWUFeW3MhaAA1ojU:C; BDUSS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; H_PS_PSSID=36555_36461_36501_36455_36414_36690_36167_36695_36697_36622_26350_36467_22159; BAIDUID=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; BAIDUID_BFESS=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; bdindexid=a17n716aovv6sp31nffonloj57; RT=\"z=1&dm=baidu.com&si=lw6v60mezv8&ss=l4y7n19q&sl=b&tt=a43&bcn=https://fclog.baidu.com/log/weirwood?type=perf\"; BDUSS_BFESS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; ab_sr=1.0.1_NWY1MTE0ZTBiNWU4ZGFlNTQwMWU2NWEzYTRhYTEzZGMyMjI0NWZiY2EwNTUzZjg2NjMzM2I5Y2FjYzYxOTQ0ZDM5YTY1MzExMzk0NmE0ODRmNjM2NzdjNDJjZGYyYmUyMmUzZjRlYTcwMDkyYTVmNmNiMTlkNzhlNmRlOGI3N2RiZWQwOTVkNTQ1OTNkNThkNzQ2NjU3ZmY0MTQ1ZmFmNA==",
-    "CliperText": "1656399607736_1656431430319_4AB9QFVS9yPO/04xkfvTZwBTR5dvR0vc288+m8IVjlgN8bMIpU6QuC2bRux22CB2Nbng1A6MN7m8IX2FO6oF15RHawNhPCcwq4Mw3QS9dBt7F9xmt4Dgk58vhHOe5x0mM54r6A4ynFeQusA66u5tdjDf15Di88ToI9hMKhcoVN+nItCTH7oEvHXKzf2R8DIwu0QcCyWgcQl4cdjq/Dg6doApJ0uejKu+ptYHJSEBLtEfQm98gTv/fOcvYcfJKYDmKQFDg3Eso9n6By/2bWBSkZIm+1gOW+80Cy448DaLJPvxso9NGiqElawftwr2kdWrqNRGDepgI5gKFpTea6SJ6Jofg/R/lWGUR76IXhlnitvurTY55t3Sli64QRxux7SUL1ghVwQln9SjlD1o4TuNskX7D6fW5d7lqXluc+KtxpeSwQtnQvgYE0cb9smSubzF7jPvkAyY3qFOKDW2eTzU6Q==",
-    "words": [
-        [
-            {
-                "name": "气候变化",
-                "wordType": 1
-            }
-        ]
-    ]
+{
+    "cookie": "BIDUPSID=94CF38B6E2B133BB95CFD7692279A2E1; PSTM=1656423206; BA_HECTOR=0l8l8g252kag0kal201hbm0p715; ZFY=T8w70A:ACckELtYIsYWBHLbsz7sugWUFeW3MhaAA1ojU:C; BDUSS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; H_PS_PSSID=36555_36461_36501_36455_36414_36690_36167_36695_36697_36622_26350_36467_22159; BAIDUID=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; BAIDUID_BFESS=94CF38B6E2B133BB56AD32A9AF8AAAB5:SL=0:NR=10:FG=1; bdindexid=a17n716aovv6sp31nffonloj57; RT=\"z=1&dm=baidu.com&si=lw6v60mezv8&ss=l4y7n19q&sl=b&tt=a43&bcn=https://fclog.baidu.com/log/weirwood?type=perf\"; BDUSS_BFESS=JxRGVZY1EyY2cxSHZoN1VES2tJRGszWHVTcXpLRWdqWUFITlB4TXdLRlNrT0ppRVFBQUFBJCQAAAAAAAAAAAEAAADrBCoHwffLrrfJt8m3ybfJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFIDu2JSA7ticG; ab_sr=1.0.1_NWY1MTE0ZTBiNWU4ZGFlNTQwMWU2NWEzYTRhYTEzZGMyMjI0NWZiY2EwNTUzZjg2NjMzM2I5Y2FjYzYxOTQ0ZDM5YTY1MzExMzk0NmE0ODRmNjM2NzdjNDJjZGYyYmUyMmUzZjRlYTcwMDkyYTVmNmNiMTlkNzhlNmRlOGI3N2RiZWQwOTVkNTQ1OTNkNThkNzQ2NjU3ZmY0MTQ1ZmFmNA==",
+    "CliperText": "1656399607736_1656431430319_4AB9QFVS9yPO/04xkfvTZwBTR5dvR0vc288+m8IVjlgN8bMIpU6QuC2bRux22CB2Nbng1A6MN7m8IX2FO6oF15RHawNhPCcwq4Mw3QS9dBt7F9xmt4Dgk58vhHOe5x0mM54r6A4ynFeQusA66u5tdjDf15Di88ToI9hMKhcoVN+nItCTH7oEvHXKzf2R8DIwu0QcCyWgcQl4cdjq/Dg6doApJ0uejKu+ptYHJSEBLtEfQm98gTv/fOcvYcfJKYDmKQFDg3Eso9n6By/2bWBSkZIm+1gOW+80Cy448DaLJPvxso9NGiqElawftwr2kdWrqNRGDepgI5gKFpTea6SJ6Jofg/R/lWGUR76IXhlnitvurTY55t3Sli64QRxux7SUL1ghVwQln9SjlD1o4TuNskX7D6fW5d7lqXluc+KtxpeSwQtnQvgYE0cb9smSubzF7jPvkAyY3qFOKDW2eTzU6Q==",
+    "words": [
+        [
+            {
+                "name": "气候变化",
+                "wordType": 1
+            }
+        ]
+    ]
 }

+ 11 - 11
main.py

@@ -1,12 +1,12 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@Contact :   liuyuqi.gov@msn.cn
-@Time    :   2022/06/28 23:14:30
-@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
-@Desc    :   main
-'''
-from crawl_baidu import main
-
-if __name__=='__main__':
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2022/06/28 23:14:30
+@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
+@Desc    :   main
+'''
+from crawl_baidu import main
+
+if __name__=='__main__':
     main()

+ 44 - 44
main.spec

@@ -1,44 +1,44 @@
-# -*- mode: python ; coding: utf-8 -*-
-
-
-block_cipher = None
-
-
-a = Analysis(
-    ['main.py'],
-    pathex=[],
-    binaries=[],
-    datas=[],
-    hiddenimports=[],
-    hookspath=[],
-    hooksconfig={},
-    runtime_hooks=[],
-    excludes=[],
-    win_no_prefer_redirects=False,
-    win_private_assemblies=False,
-    cipher=block_cipher,
-    noarchive=False,
-)
-pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
-
-exe = EXE(
-    pyz,
-    a.scripts,
-    a.binaries,
-    a.zipfiles,
-    a.datas,
-    [],
-    name='main',
-    debug=False,
-    bootloader_ignore_signals=False,
-    strip=False,
-    upx=True,
-    upx_exclude=[],
-    runtime_tmpdir=None,
-    console=True,
-    disable_windowed_traceback=False,
-    argv_emulation=False,
-    target_arch=None,
-    codesign_identity=None,
-    entitlements_file=None,
-)
+# -*- mode: python ; coding: utf-8 -*-
+
+
+block_cipher = None
+
+
+a = Analysis(
+    ['main.py'],
+    pathex=[],
+    binaries=[],
+    datas=[],
+    hiddenimports=[],
+    hookspath=[],
+    hooksconfig={},
+    runtime_hooks=[],
+    excludes=[],
+    win_no_prefer_redirects=False,
+    win_private_assemblies=False,
+    cipher=block_cipher,
+    noarchive=False,
+)
+pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
+
+exe = EXE(
+    pyz,
+    a.scripts,
+    a.binaries,
+    a.zipfiles,
+    a.datas,
+    [],
+    name='main',
+    debug=False,
+    bootloader_ignore_signals=False,
+    strip=False,
+    upx=True,
+    upx_exclude=[],
+    runtime_tmpdir=None,
+    console=True,
+    disable_windowed_traceback=False,
+    argv_emulation=False,
+    target_arch=None,
+    codesign_identity=None,
+    entitlements_file=None,
+)

+ 2 - 1
requirements.txt

@@ -1 +1,2 @@
-requests
+requests==2.27.1
+PyQt5==5.9.2