瀏覽代碼

'上传至服务器仓库'

Your Name 6 年之前
當前提交
b2a7294cfb
共有 53 個文件被更改,包括 5758 次插入0 次删除
  1. 二進制
      new_hg3535s/.scrapy/deltafetch/bangqiu.db
  2. 二進制
      new_hg3535s/.scrapy/deltafetch/guanjun.db
  3. 二進制
      new_hg3535s/.scrapy/deltafetch/lanqiu.db
  4. 二進制
      new_hg3535s/.scrapy/deltafetch/liansai.db
  5. 二進制
      new_hg3535s/.scrapy/deltafetch/testone.db
  6. 二進制
      new_hg3535s/.scrapy/deltafetch/wangqiu.db
  7. 二進制
      new_hg3535s/.scrapy/deltafetch/wqbodan.db
  8. 二進制
      new_hg3535s/.scrapy/deltafetch/zuqiu.db
  9. 5 0
      new_hg3535s/hg3535/.idea/codeStyles/codeStyleConfig.xml
  10. 3 0
      new_hg3535s/hg3535/.idea/dictionaries/admin.xml
  11. 6 0
      new_hg3535s/hg3535/.idea/encodings.xml
  12. 17 0
      new_hg3535s/hg3535/.idea/hg3535.iml
  13. 12 0
      new_hg3535s/hg3535/.idea/inspectionProfiles/Project_Default.xml
  14. 6 0
      new_hg3535s/hg3535/.idea/libraries/R_User_Library.xml
  15. 7 0
      new_hg3535s/hg3535/.idea/misc.xml
  16. 8 0
      new_hg3535s/hg3535/.idea/modules.xml
  17. 6 0
      new_hg3535s/hg3535/.idea/vcs.xml
  18. 1041 0
      new_hg3535s/hg3535/.idea/workspace.xml
  19. 2 0
      new_hg3535s/hg3535/__init__.py
  20. 二進制
      new_hg3535s/hg3535/__pycache__/__init__.cpython-36.pyc
  21. 二進制
      new_hg3535s/hg3535/__pycache__/items.cpython-36.pyc
  22. 二進制
      new_hg3535s/hg3535/__pycache__/middlewares.cpython-36.pyc
  23. 二進制
      new_hg3535s/hg3535/__pycache__/pipelines.cpython-36.pyc
  24. 二進制
      new_hg3535s/hg3535/__pycache__/settings.cpython-36.pyc
  25. 252 0
      new_hg3535s/hg3535/items.py
  26. 45 0
      new_hg3535s/hg3535/jianting.py
  27. 13 0
      new_hg3535s/hg3535/main.py
  28. 104 0
      new_hg3535s/hg3535/middlewares.py
  29. 0 0
      new_hg3535s/hg3535/pip
  30. 1802 0
      new_hg3535s/hg3535/pipelines.py
  31. 71 0
      new_hg3535s/hg3535/requirements.txt
  32. 0 0
      new_hg3535s/hg3535/scrapy-magicfields)
  33. 126 0
      new_hg3535s/hg3535/settings.py
  34. 4 0
      new_hg3535s/hg3535/spiders/__init__.py
  35. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/__init__.cpython-36.pyc
  36. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/bangqiu.cpython-36.pyc
  37. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/guanjun.cpython-36.pyc
  38. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/lanqiu.cpython-36.pyc
  39. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/liansai.cpython-36.pyc
  40. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/wangqiu.cpython-36.pyc
  41. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/wgbodan.cpython-36.pyc
  42. 二進制
      new_hg3535s/hg3535/spiders/__pycache__/zuqiu.cpython-36.pyc
  43. 245 0
      new_hg3535s/hg3535/spiders/bangqiu.py
  44. 76 0
      new_hg3535s/hg3535/spiders/guanjun.py
  45. 851 0
      new_hg3535s/hg3535/spiders/lanqiu.py
  46. 58 0
      new_hg3535s/hg3535/spiders/liansai.py
  47. 257 0
      new_hg3535s/hg3535/spiders/wangqiu.py
  48. 110 0
      new_hg3535s/hg3535/spiders/wgbodan.py
  49. 552 0
      new_hg3535s/hg3535/spiders/zuqiu.py
  50. 0 0
      new_hg3535s/pip
  51. 68 0
      new_hg3535s/requirements.txt
  52. 0 0
      new_hg3535s/scrapy-magicfields)
  53. 11 0
      new_hg3535s/scrapy.cfg

二進制
new_hg3535s/.scrapy/deltafetch/bangqiu.db


二進制
new_hg3535s/.scrapy/deltafetch/guanjun.db


二進制
new_hg3535s/.scrapy/deltafetch/lanqiu.db


二進制
new_hg3535s/.scrapy/deltafetch/liansai.db


二進制
new_hg3535s/.scrapy/deltafetch/testone.db


二進制
new_hg3535s/.scrapy/deltafetch/wangqiu.db


二進制
new_hg3535s/.scrapy/deltafetch/wqbodan.db


二進制
new_hg3535s/.scrapy/deltafetch/zuqiu.db


+ 5 - 0
new_hg3535s/hg3535/.idea/codeStyles/codeStyleConfig.xml

@@ -0,0 +1,5 @@
+<component name="ProjectCodeStyleConfiguration">
+  <state>
+    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
+  </state>
+</component>

+ 3 - 0
new_hg3535s/hg3535/.idea/dictionaries/admin.xml

@@ -0,0 +1,3 @@
+<component name="ProjectDictionaryState">
+  <dictionary name="admin" />
+</component>

+ 6 - 0
new_hg3535s/hg3535/.idea/encodings.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" addBOMForNewFiles="with NO BOM">
+    <file url="file://$PROJECT_DIR$/zuqiu.json" charset="UTF-8" />
+  </component>
+</project>

+ 17 - 0
new_hg3535s/hg3535/.idea/hg3535.iml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/spiders" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="R User Library" level="project" />
+    <orderEntry type="library" name="R Skeletons" level="application" />
+  </component>
+  <component name="TestRunnerService">
+    <option name="projectConfiguration" value="Twisted Trial" />
+    <option name="PROJECT_TEST_RUNNER" value="Twisted Trial" />
+  </component>
+</module>

+ 12 - 0
new_hg3535s/hg3535/.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,12 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="PyPackageRequirementsInspection" enabled="false" level="WARNING" enabled_by_default="false">
+      <option name="ignoredPackages">
+        <value>
+          <list size="0" />
+        </value>
+      </option>
+    </inspection_tool>
+  </profile>
+</component>

+ 6 - 0
new_hg3535s/hg3535/.idea/libraries/R_User_Library.xml

@@ -0,0 +1,6 @@
+<component name="libraryTable">
+  <library name="R User Library">
+    <CLASSES />
+    <SOURCES />
+  </library>
+</component>

+ 7 - 0
new_hg3535s/hg3535/.idea/misc.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="JavaScriptSettings">
+    <option name="languageLevel" value="ES6" />
+  </component>
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
+</project>

+ 8 - 0
new_hg3535s/hg3535/.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/hg3535.iml" filepath="$PROJECT_DIR$/.idea/hg3535.iml" />
+    </modules>
+  </component>
+</project>

+ 6 - 0
new_hg3535s/hg3535/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
+  </component>
+</project>

+ 1041 - 0
new_hg3535s/hg3535/.idea/workspace.xml

@@ -0,0 +1,1041 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ChangeListManager">
+    <list default="true" id="7fa42e97-ddea-4404-91db-5a9ccc162649" name="Default Changelist" comment="">
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+    </list>
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="CoverageDataManager">
+    <SUITE FILE_PATH="coverage/hg3535$items.coverage" NAME="items Coverage Results" MODIFIED="1554291398794" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
+    <SUITE FILE_PATH="coverage/hg3535$main.coverage" NAME="main Coverage Results" MODIFIED="1557048948143" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
+    <SUITE FILE_PATH="coverage/hg3535$halffull.coverage" NAME="halffull Coverage Results" MODIFIED="1554544334424" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/spiders" />
+    <SUITE FILE_PATH="coverage/hg3535$pipelines.coverage" NAME="pipelines Coverage Results" MODIFIED="1554290866137" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
+    <SUITE FILE_PATH="coverage/hg3535$today_all.coverage" NAME="today_all Coverage Results" MODIFIED="1553172114927" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/spiders" />
+    <SUITE FILE_PATH="coverage/hg3535$model.coverage" NAME="model Coverage Results" MODIFIED="1554113916027" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
+    <SUITE FILE_PATH="coverage/hg3535$wangqiu.coverage" NAME="wangqiu Coverage Results" MODIFIED="1555149820033" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/spiders" />
+    <SUITE FILE_PATH="coverage/hg3535$liansai.coverage" NAME="liansai Coverage Results" MODIFIED="1554879155855" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/spiders" />
+  </component>
+  <component name="DatabaseView">
+    <option name="SHOW_INTERMEDIATE" value="true" />
+    <option name="GROUP_DATA_SOURCES" value="true" />
+    <option name="GROUP_SCHEMA" value="true" />
+    <option name="GROUP_CONTENTS" value="false" />
+    <option name="SORT_POSITIONED" value="false" />
+    <option name="SHOW_EMPTY_GROUPS" value="false" />
+    <option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
+    <option name="HIDDEN_KINDS">
+      <set />
+    </option>
+    <expand />
+    <select />
+  </component>
+  <component name="FavoritesManager">
+    <favorites_list name="hg3535" />
+  </component>
+  <component name="FileEditorManager">
+    <leaf>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/items.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="-2932">
+              <caret line="50" lean-forward="true" selection-start-line="50" selection-end-line="50" />
+              <folding>
+                <element signature="e#320#1230#0" />
+                <element signature="e#1382#1528#0" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="72">
+              <caret line="130" column="37" lean-forward="true" selection-start-line="130" selection-start-column="37" selection-end-line="130" selection-end-column="37" />
+              <folding>
+                <element signature="e#24#35#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/jianting.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="324">
+              <caret line="18" column="14" lean-forward="true" selection-start-line="18" selection-start-column="14" selection-end-line="18" selection-end-column="14" />
+              <folding>
+                <element signature="e#0#9#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/spiders/liansai.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="23">
+              <caret line="21" column="31" selection-start-line="21" selection-start-column="31" selection-end-line="21" selection-end-column="31" />
+              <folding>
+                <element signature="e#24#35#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/pipelines.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="265">
+              <caret line="392" column="50" lean-forward="true" selection-start-line="392" selection-start-column="50" selection-end-line="392" selection-end-column="50" />
+              <folding>
+                <element signature="e#193#208#0" expanded="true" />
+                <element signature="e#18330#19014#0" />
+                <element signature="e#25714#29974#0" />
+                <element signature="e#34571#39061#0" />
+                <element signature="e#39126#43615#0" />
+                <element signature="e#43680#48166#0" />
+                <element signature="e#48346#53071#0" />
+                <element signature="e#53251#58051#0" />
+                <element signature="e#58092#58573#0" />
+                <element signature="e#58725#74468#0" />
+                <element signature="e#74621#82064#0" />
+                <element signature="e#82218#92209#0" />
+                <element signature="e#92365#99910#0" />
+                <element signature="e#100064#109753#0" />
+                <element signature="e#115021#121360#0" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/settings.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="153">
+              <caret line="117" lean-forward="true" selection-start-line="117" selection-end-line="117" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/main.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="234">
+              <caret line="13" lean-forward="true" selection-start-line="13" selection-end-line="13" />
+              <folding>
+                <element signature="e#0#10#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
+  </component>
+  <component name="FileTemplateManagerImpl">
+    <option name="RECENT_TEMPLATES">
+      <list>
+        <option value="Python Script" />
+      </list>
+    </option>
+  </component>
+  <component name="FindInProjectRecents">
+    <findStrings>
+      <find>chuanchang</find>
+      <find>%d</find>
+      <find>data</find>
+      <find>es</find>
+      <find>new_list</find>
+      <find>bodan</find>
+      <find>fbnp_all</find>
+      <find>htft</find>
+      <find>half_capot</find>
+      <find>capot</find>
+      <find>t1</find>
+      <find>pid</find>
+      <find>corner_ball</find>
+      <find>print</find>
+      <find>match_id</find>
+      <find>half_concede_home</find>
+      <find>conn</find>
+      <find>result</find>
+      <find>score_home</find>
+      <find>capots_dict</find>
+      <find>half_size_home</find>
+      <find>last_number</find>
+      <find>total_goals</find>
+      <find>2or7</find>
+      <find>st_zq_league</find>
+      <find>zqtwo_intodb</find>
+      <find>odds_only</find>
+    </findStrings>
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
+  </component>
+  <component name="IdeDocumentHistory">
+    <option name="CHANGED_PATHS">
+      <list>
+        <option value="$PROJECT_DIR$/spiders/bifen.py" />
+        <option value="$PROJECT_DIR$/spiders/jinri.py" />
+        <option value="$PROJECT_DIR$/spiders/chuanchang.py" />
+        <option value="$PROJECT_DIR$/spiders/chuan_c.py" />
+        <option value="$PROJECT_DIR$/__init__.py" />
+        <option value="$PROJECT_DIR$/spiders/chuan.py" />
+        <option value="$PROJECT_DIR$/spiders/cchang.py" />
+        <option value="$PROJECT_DIR$/chuanchang1.csv" />
+        <option value="$PROJECT_DIR$/spiders/gunqiu.py" />
+        <option value="$PROJECT_DIR$/spiders/xiangxi.py" />
+        <option value="$PROJECT_DIR$/test.json" />
+        <option value="$PROJECT_DIR$/model.py" />
+        <option value="$PROJECT_DIR$/models.py" />
+        <option value="$PROJECT_DIR$/spiders/today_all.py" />
+        <option value="$PROJECT_DIR$/spiders/bqrangqiu.py" />
+        <option value="$PROJECT_DIR$/getcode.py" />
+        <option value="$PROJECT_DIR$/spiders/bangqiuls.py" />
+        <option value="$PROJECT_DIR$/spiders/duying.py" />
+        <option value="$PROJECT_DIR$/spiders/danshuang.py" />
+        <option value="$PROJECT_DIR$/spiders/bodan.py" />
+        <option value="$PROJECT_DIR$/spiders/firstlast.py" />
+        <option value="$PROJECT_DIR$/spiders/bqguanjun.py" />
+        <option value="$PROJECT_DIR$/spiders/halffull.py" />
+        <option value="$PROJECT_DIR$/spiders/rangqiu.py" />
+        <option value="$PROJECT_DIR$/spiders/totalball.py" />
+        <option value="$PROJECT_DIR$/spiders/wangqiuls.py" />
+        <option value="$PROJECT_DIR$/spiders/temaball.py" />
+        <option value="$PROJECT_DIR$/spiders/wqguanjun.py" />
+        <option value="$PROJECT_DIR$/spiders/lqguanjun.py" />
+        <option value="$PROJECT_DIR$/spiders/lanqiuls.py" />
+        <option value="$PROJECT_DIR$/spiders/testone.py" />
+        <option value="$PROJECT_DIR$/items.py" />
+        <option value="$PROJECT_DIR$/middlewares.py" />
+        <option value="$PROJECT_DIR$/spiders/wangqiu.py" />
+        <option value="$PROJECT_DIR$/spiders/guanjun.py" />
+        <option value="$PROJECT_DIR$/spiders/bangqiu.py" />
+        <option value="$PROJECT_DIR$/spiders/wgbodan.py" />
+        <option value="$PROJECT_DIR$/jianting.py" />
+        <option value="$PROJECT_DIR$/spiders/lanqiu.py" />
+        <option value="$PROJECT_DIR$/spiders/liansai.py" />
+        <option value="$PROJECT_DIR$/spiders/zuqiu.py" />
+        <option value="$PROJECT_DIR$/settings.py" />
+        <option value="$PROJECT_DIR$/main.py" />
+        <option value="$PROJECT_DIR$/pipelines.py" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectFrameBounds" extendedState="6">
+    <option name="x" value="-8" />
+    <option name="y" value="-8" />
+    <option name="width" value="1583" />
+    <option name="height" value="1064" />
+  </component>
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
+  <component name="ProjectView">
+    <navigator proportions="" version="1">
+      <foldersAlwaysOnTop value="true" />
+    </navigator>
+    <panes>
+      <pane id="ProjectPane">
+        <subPane>
+          <expand>
+            <path>
+              <item name="hg3535" type="b2602c69:ProjectViewProjectNode" />
+              <item name="hg3535" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="hg3535" type="b2602c69:ProjectViewProjectNode" />
+              <item name="hg3535" type="462c0819:PsiDirectoryNode" />
+              <item name="spiders" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="hg3535" type="b2602c69:ProjectViewProjectNode" />
+              <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
+            </path>
+          </expand>
+          <select />
+        </subPane>
+      </pane>
+      <pane id="Scope" />
+    </panes>
+  </component>
+  <component name="PropertiesComponent">
+    <property name="WebServerToolWindowFactoryState" value="false" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/../../../onetest/onetest" />
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
+    <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
+  </component>
+  <component name="RunDashboard">
+    <option name="ruleStates">
+      <list>
+        <RuleState>
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
+        </RuleState>
+        <RuleState>
+          <option name="name" value="StatusDashboardGroupingRule" />
+        </RuleState>
+      </list>
+    </option>
+  </component>
+  <component name="RunManager" selected="Python.main">
+    <configuration name="halffull" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <module name="hg3535" />
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/spiders" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/spiders/halffull.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <option name="EMULATE_TERMINAL" value="false" />
+      <option name="MODULE_MODE" value="false" />
+      <option name="REDIRECT_INPUT" value="false" />
+      <option name="INPUT_FILE" value="" />
+      <method v="2" />
+    </configuration>
+    <configuration name="items" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <module name="hg3535" />
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/items.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <option name="EMULATE_TERMINAL" value="false" />
+      <option name="MODULE_MODE" value="false" />
+      <option name="REDIRECT_INPUT" value="false" />
+      <option name="INPUT_FILE" value="" />
+      <method v="2" />
+    </configuration>
+    <configuration name="liansai" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <module name="hg3535" />
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/spiders" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/spiders/liansai.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <option name="EMULATE_TERMINAL" value="false" />
+      <option name="MODULE_MODE" value="false" />
+      <option name="REDIRECT_INPUT" value="false" />
+      <option name="INPUT_FILE" value="" />
+      <method v="2" />
+    </configuration>
+    <configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <module name="hg3535" />
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <option name="EMULATE_TERMINAL" value="false" />
+      <option name="MODULE_MODE" value="false" />
+      <option name="REDIRECT_INPUT" value="false" />
+      <option name="INPUT_FILE" value="" />
+      <method v="2" />
+    </configuration>
+    <configuration name="wangqiu" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <module name="hg3535" />
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/spiders" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/spiders/wangqiu.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <option name="EMULATE_TERMINAL" value="false" />
+      <option name="MODULE_MODE" value="false" />
+      <option name="REDIRECT_INPUT" value="false" />
+      <option name="INPUT_FILE" value="" />
+      <method v="2" />
+    </configuration>
+    <recent_temporary>
+      <list>
+        <item itemvalue="Python.main" />
+        <item itemvalue="Python.wangqiu" />
+        <item itemvalue="Python.liansai" />
+        <item itemvalue="Python.halffull" />
+        <item itemvalue="Python.items" />
+      </list>
+    </recent_temporary>
+  </component>
+  <component name="SvnConfiguration">
+    <configuration>C:\Users\admin\AppData\Roaming\Subversion</configuration>
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="7fa42e97-ddea-4404-91db-5a9ccc162649" name="Default Changelist" comment="" />
+      <created>1552361933913</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1552361933913</updated>
+      <workItem from="1552361935189" duration="22939000" />
+      <workItem from="1552439490626" duration="18066000" />
+      <workItem from="1552524796712" duration="27465000" />
+      <workItem from="1552567426062" duration="7518000" />
+      <workItem from="1552575496568" duration="1826000" />
+      <workItem from="1552577490969" duration="704000" />
+      <workItem from="1552580284900" duration="495000" />
+      <workItem from="1552611273446" duration="5372000" />
+      <workItem from="1552617365681" duration="4071000" />
+      <workItem from="1552621477059" duration="24443000" />
+      <workItem from="1552723083507" duration="1264000" />
+      <workItem from="1552744211477" duration="1268000" />
+      <workItem from="1552789416500" duration="25000" />
+      <workItem from="1552899019763" duration="39045000" />
+      <workItem from="1553043681027" duration="145839000" />
+      <workItem from="1553397105996" duration="23148000" />
+      <workItem from="1553433705348" duration="1018000" />
+      <workItem from="1553475342218" duration="23428000" />
+      <workItem from="1553503466782" duration="5588000" />
+      <workItem from="1553513531340" duration="13843000" />
+      <workItem from="1553561440191" duration="133112000" />
+      <workItem from="1553931675476" duration="17232000" />
+      <workItem from="1554080350424" duration="17288000" />
+      <workItem from="1554101826084" duration="19370000" />
+      <workItem from="1554170199956" duration="2159000" />
+      <workItem from="1554172621503" duration="3788000" />
+      <workItem from="1554176443957" duration="28339000" />
+      <workItem from="1554215166308" duration="2338000" />
+      <workItem from="1554252224751" duration="1384000" />
+      <workItem from="1554253767232" duration="20266000" />
+      <workItem from="1554276949053" duration="7482000" />
+      <workItem from="1554284600072" duration="14592000" />
+      <workItem from="1554306136130" duration="34310000" />
+      <workItem from="1554384538601" duration="87371000" />
+      <workItem from="1554685163974" duration="34853000" />
+      <workItem from="1554735546675" duration="3652000" />
+      <workItem from="1554771709150" duration="15315000" />
+      <workItem from="1554860005406" duration="38399000" />
+      <workItem from="1554956837583" duration="21067000" />
+      <workItem from="1554989742904" duration="21354000" />
+      <workItem from="1555046975903" duration="68970000" />
+      <workItem from="1555212709284" duration="5832000" />
+      <workItem from="1555289493716" duration="16563000" />
+      <workItem from="1555376280859" duration="17600000" />
+      <workItem from="1555405622542" duration="620000" />
+      <workItem from="1555406260234" duration="6046000" />
+      <workItem from="1555414794521" duration="6416000" />
+      <workItem from="1555462498299" duration="20842000" />
+      <workItem from="1555498934960" duration="21460000" />
+      <workItem from="1555566912269" duration="9942000" />
+      <workItem from="1555579873287" duration="1062000" />
+      <workItem from="1555635203399" duration="12245000" />
+      <workItem from="1555658501528" duration="9655000" />
+      <workItem from="1555671859532" duration="35975000" />
+      <workItem from="1555893403863" duration="8143000" />
+      <workItem from="1555916236353" duration="9945000" />
+      <workItem from="1555981119140" duration="24628000" />
+      <workItem from="1556067504720" duration="23664000" />
+      <workItem from="1556106028857" duration="5358000" />
+      <workItem from="1556161598731" duration="19181000" />
+      <workItem from="1556240187201" duration="11026000" />
+      <workItem from="1556254654110" duration="38231000" />
+      <workItem from="1556500244997" duration="22444000" />
+      <workItem from="1556584868377" duration="15320000" />
+      <workItem from="1557018228723" duration="19258000" />
+    </task>
+    <task id="LOCAL-00001" summary="修改后,版本二">
+      <created>1555727493584</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1555727493585</updated>
+    </task>
+    <task id="LOCAL-00002" summary="修改联赛url">
+      <created>1555727573940</created>
+      <option name="number" value="00002" />
+      <option name="presentableId" value="LOCAL-00002" />
+      <option name="project" value="LOCAL" />
+      <updated>1555727573940</updated>
+    </task>
+    <task id="LOCAL-00003" summary="修改联赛错误">
+      <created>1555727734616</created>
+      <option name="number" value="00003" />
+      <option name="presentableId" value="LOCAL-00003" />
+      <option name="project" value="LOCAL" />
+      <updated>1555727734616</updated>
+    </task>
+    <task id="LOCAL-00004" summary="修改冠军,导入错误">
+      <created>1555727939763</created>
+      <option name="number" value="00004" />
+      <option name="presentableId" value="LOCAL-00004" />
+      <option name="project" value="LOCAL" />
+      <updated>1555727939763</updated>
+    </task>
+    <task id="LOCAL-00005" summary="修改棒球,联赛无法写入">
+      <created>1555728369459</created>
+      <option name="number" value="00005" />
+      <option name="presentableId" value="LOCAL-00005" />
+      <option name="project" value="LOCAL" />
+      <updated>1555728369459</updated>
+    </task>
+    <task id="LOCAL-00006" summary="修改冠军,联赛url">
+      <created>1555747152483</created>
+      <option name="number" value="00006" />
+      <option name="presentableId" value="LOCAL-00006" />
+      <option name="project" value="LOCAL" />
+      <updated>1555747152483</updated>
+    </task>
+    <task id="LOCAL-00007" summary="不启用,scrapy_deltafetch">
+      <created>1555902621561</created>
+      <option name="number" value="00007" />
+      <option name="presentableId" value="LOCAL-00007" />
+      <option name="project" value="LOCAL" />
+      <updated>1555902621561</updated>
+    </task>
+    <task id="LOCAL-00008" summary="修改棒球联赛表写入错误">
+      <created>1555925357368</created>
+      <option name="number" value="00008" />
+      <option name="presentableId" value="LOCAL-00008" />
+      <option name="project" value="LOCAL" />
+      <updated>1555925357368</updated>
+    </task>
+    <task id="LOCAL-00009" summary="修改冠军">
+      <created>1555989344488</created>
+      <option name="number" value="00009" />
+      <option name="presentableId" value="LOCAL-00009" />
+      <option name="project" value="LOCAL" />
+      <updated>1555989344488</updated>
+    </task>
+    <task id="LOCAL-00010" summary="联赛添加redis测试">
+      <created>1556014183609</created>
+      <option name="number" value="00010" />
+      <option name="presentableId" value="LOCAL-00010" />
+      <option name="project" value="LOCAL" />
+      <updated>1556014183609</updated>
+    </task>
+    <task id="LOCAL-00011" summary="联赛添加冠军,联赛过滤">
+      <created>1556102057191</created>
+      <option name="number" value="00011" />
+      <option name="presentableId" value="LOCAL-00011" />
+      <option name="project" value="LOCAL" />
+      <updated>1556102057191</updated>
+    </task>
+    <task id="LOCAL-00012" summary="修改足球,篮球赔率表插入">
+      <created>1556186556377</created>
+      <option name="number" value="00012" />
+      <option name="presentableId" value="LOCAL-00012" />
+      <option name="project" value="LOCAL" />
+      <updated>1556186556377</updated>
+    </task>
+    <task id="LOCAL-00013" summary="修改赔率条件,部分赔率减1">
+      <created>1556430855618</created>
+      <option name="number" value="00013" />
+      <option name="presentableId" value="LOCAL-00013" />
+      <option name="project" value="LOCAL" />
+      <updated>1556430855618</updated>
+    </task>
+    <task id="LOCAL-00014" summary="添加冠军赛事信息,到赛事表中">
+      <created>1557042186914</created>
+      <option name="number" value="00014" />
+      <option name="presentableId" value="LOCAL-00014" />
+      <option name="project" value="LOCAL" />
+      <updated>1557042186914</updated>
+    </task>
+    <task id="LOCAL-00015" summary="修改setting">
+      <created>1557050308399</created>
+      <option name="number" value="00015" />
+      <option name="presentableId" value="LOCAL-00015" />
+      <option name="project" value="LOCAL" />
+      <updated>1557050308399</updated>
+    </task>
+    <option name="localTasksCounter" value="16" />
+    <servers />
+  </component>
+  <component name="TimeTrackingManager">
+    <option name="totallyTimeSpent" value="1326611000" />
+  </component>
+  <component name="TodoView">
+    <todo-panel id="selected-file">
+      <is-autoscroll-to-source value="true" />
+    </todo-panel>
+    <todo-panel id="all">
+      <are-packages-shown value="true" />
+      <is-autoscroll-to-source value="true" />
+    </todo-panel>
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
+    <layout>
+      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.71173847" visible="true" weight="0.16044776" />
+      <window_info id="Structure" order="1" sideWeight="0.2882615" side_tool="true" weight="0.1108742" />
+      <window_info id="Favorites" order="2" sideWeight="0.5013405" side_tool="true" weight="0.108208954" />
+      <window_info anchor="bottom" id="Message" order="0" />
+      <window_info anchor="bottom" id="Find" order="1" weight="0.3290461" />
+      <window_info anchor="bottom" id="Debug" order="2" sideWeight="0.49946696" weight="0.30686694" />
+      <window_info anchor="bottom" id="Cvs" order="3" weight="0.25" />
+      <window_info anchor="bottom" id="Inspection" order="4" weight="0.4" />
+      <window_info anchor="bottom" id="TODO" order="5" weight="0.32832617" />
+      <window_info anchor="bottom" id="Docker" order="6" show_stripe_button="false" />
+      <window_info anchor="bottom" id="Version Control" order="7" weight="0.2918455" />
+      <window_info anchor="bottom" id="Database Changes" order="8" />
+      <window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.5042644" side_tool="true" weight="0.4195279" />
+      <window_info anchor="bottom" x="22" y="376" width="1876" height="298" id="Terminal" order="10" sideWeight="0.49573562" weight="0.16021505" />
+      <window_info anchor="bottom" id="Python Console" order="11" sideWeight="0.49946696" weight="0.41309014" />
+      <window_info anchor="bottom" id="Run" order="12" sideWeight="0.4946695" weight="0.45922747" />
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
+      <window_info anchor="right" id="SciView" order="3" weight="0.32995737" />
+      <window_info anchor="right" id="Database" order="4" weight="0.32995737" />
+      <window_info anchor="right" id="R Packages" order="5" weight="0.32889125" />
+      <window_info anchor="right" id="R Graphics" order="6" weight="0.32995737" />
+    </layout>
+    <layout-to-restore>
+      <window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.71173847" visible="true" weight="0.18017058" />
+      <window_info id="Structure" order="1" sideWeight="0.2882615" side_tool="true" weight="0.1108742" />
+      <window_info id="Favorites" order="2" sideWeight="0.5013405" side_tool="true" weight="0.108208954" />
+      <window_info anchor="bottom" id="Message" order="0" />
+      <window_info anchor="bottom" id="Find" order="1" weight="0.3290461" />
+      <window_info anchor="bottom" id="Debug" order="2" sideWeight="0.49946696" weight="0.29291844" />
+      <window_info anchor="bottom" id="Cvs" order="3" weight="0.25" />
+      <window_info anchor="bottom" id="Inspection" order="4" weight="0.4" />
+      <window_info anchor="bottom" id="TODO" order="5" weight="0.32832617" />
+      <window_info anchor="bottom" id="Docker" order="6" show_stripe_button="false" />
+      <window_info anchor="bottom" id="Version Control" order="7" weight="0.32939914" />
+      <window_info anchor="bottom" id="Database Changes" order="8" />
+      <window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.5042644" side_tool="true" weight="0.4195279" />
+      <window_info anchor="bottom" x="22" y="376" width="1876" height="298" id="Terminal" order="10" sideWeight="0.49573562" visible="true" weight="0.41523606" />
+      <window_info anchor="bottom" id="Python Console" order="11" sideWeight="0.49946696" weight="0.41371918" />
+      <window_info anchor="bottom" id="Run" order="12" sideWeight="0.4946695" weight="0.51824033" />
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
+      <window_info anchor="right" id="SciView" order="3" weight="0.32995737" />
+      <window_info anchor="right" id="Database" order="4" weight="0.32995737" />
+      <window_info anchor="right" id="R Packages" order="5" weight="0.32889125" />
+      <window_info anchor="right" id="R Graphics" order="6" weight="0.32995737" />
+    </layout-to-restore>
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="1" />
+  </component>
+  <component name="VcsManagerConfiguration">
+    <MESSAGE value="修改后,版本二" />
+    <MESSAGE value="修改联赛url" />
+    <MESSAGE value="修改联赛错误" />
+    <MESSAGE value="修改冠军,导入错误" />
+    <MESSAGE value="修改棒球,联赛无法写入" />
+    <MESSAGE value="修改冠军,联赛url" />
+    <MESSAGE value="不启用,scrapy_deltafetch" />
+    <MESSAGE value="修改棒球联赛表写入错误" />
+    <MESSAGE value="修改冠军" />
+    <MESSAGE value="联赛添加redis测试" />
+    <MESSAGE value="联赛添加冠军,联赛过滤" />
+    <MESSAGE value="修改足球,篮球赔率表插入" />
+    <MESSAGE value="修改赔率条件,部分赔率减1" />
+    <MESSAGE value="添加冠军赛事信息,到赛事表中" />
+    <MESSAGE value="修改setting" />
+    <option name="LAST_COMMIT_MESSAGE" value="修改setting" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager>
+      <breakpoints>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy_deltafetch/middleware.py</url>
+          <line>84</line>
+          <option name="timeStamp" value="4" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/middlewares.py</url>
+          <line>28</line>
+          <option name="timeStamp" value="16" />
+        </line-breakpoint>
+      </breakpoints>
+      <default-breakpoints>
+        <breakpoint type="python-exception">
+          <properties notifyOnTerminate="true" exception="BaseException">
+            <option name="notifyOnTerminate" value="true" />
+          </properties>
+        </breakpoint>
+      </default-breakpoints>
+    </breakpoint-manager>
+  </component>
+  <component name="debuggerHistoryManager">
+    <expressions id="watch">
+      <expression>
+        <expression-string>value['t1']</expression-string>
+        <language-id>Python</language-id>
+        <evaluation-mode>EXPRESSION</evaluation-mode>
+      </expression>
+    </expressions>
+    <expressions id="setValue">
+      <expression>
+        <expression-string>'UPDATE xq_table SET xq = 11111111 whever id = 3074316;'</expression-string>
+        <language-id>Python</language-id>
+        <evaluation-mode>EXPRESSION</evaluation-mode>
+      </expression>
+    </expressions>
+  </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/spiders/bangqiuls.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/bqguanjun.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/wangqiuls.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/bodan.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/duying.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/firstlast.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/halffull.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/danshuang.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/totalball.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/rangqiu.py" />
+    <entry file="file://$PROJECT_DIR$/spiders/wqguanjun.py" />
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/spiderloader.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="120">
+          <caret line="70" selection-start-line="70" selection-end-line="70" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/testone.py" />
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/http/__init__.py">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/w3lib/util.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="193">
+          <caret line="19" selection-start-line="19" selection-end-line="19" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/encodings/idna.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="543">
+          <caret line="167" selection-start-line="167" selection-end-line="167" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/w3lib/url.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="319">
+          <caret line="396" selection-start-line="396" selection-end-line="396" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/utils/request.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="268">
+          <caret line="52" selection-start-line="52" selection-end-line="52" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/utils/python.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="327">
+          <caret line="121" selection-start-line="121" selection-end-line="121" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/http/response/text.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="151">
+          <caret line="72" selection-start-line="72" selection-end-line="72" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/spidermiddlewares/urllength.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="329">
+          <caret line="36" selection-start-line="36" selection-end-line="36" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/utils/defer.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="257">
+          <caret line="101" selection-start-line="101" selection-end-line="101" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/psycopg2/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="423">
+          <caret line="125" selection-start-line="125" selection-end-line="125" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/spidermiddlewares/depth.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="471">
+          <caret line="57" selection-start-line="57" selection-end-line="57" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy_deltafetch/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state>
+          <caret column="12" selection-start-column="12" selection-end-column="12" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy_deltafetch/middleware.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="924">
+          <caret line="93" column="28" lean-forward="true" selection-start-line="93" selection-start-column="28" selection-end-line="93" selection-end-column="28" />
+          <folding>
+            <element signature="e#0#14#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/spidermiddlewares/referer.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="151">
+          <caret line="338" selection-start-line="338" selection-end-line="338" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/http/request/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="414">
+          <caret line="51" selection-start-line="51" selection-end-line="51" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/urllib/parse.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="156">
+          <caret line="114" selection-start-line="114" selection-end-line="114" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/utils/httpobj.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="180">
+          <caret line="12" selection-start-line="12" selection-end-line="12" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/spidermiddlewares/offsite.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="192">
+          <caret line="47" selection-start-line="47" selection-end-line="47" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/core/spidermw.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="151">
+          <caret line="41" selection-start-line="41" selection-end-line="41" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/redis/client.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="141">
+          <caret line="615" selection-start-line="615" selection-end-line="615" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/utils/misc.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="464">
+          <caret line="141" selection-start-line="141" selection-end-line="141" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/pprint.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="149">
+          <caret line="56" selection-start-line="56" selection-end-line="56" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python36/Lib/site-packages/scrapy/middleware.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="450">
+          <caret line="31" selection-start-line="31" selection-end-line="31" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/middlewares.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="648">
+          <caret line="36" selection-start-line="36" selection-end-line="36" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/bangqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="777">
+          <caret line="60" column="17" lean-forward="true" selection-start-line="60" selection-start-column="17" selection-end-line="60" selection-end-column="17" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/guanjun.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="273">
+          <caret line="37" column="21" selection-start-line="37" selection-start-column="17" selection-end-line="37" selection-end-column="21" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/myspider/requests.seen" />
+    <entry file="file://$PROJECT_DIR$/spiders/lanqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="907">
+          <caret line="593" column="58" selection-start-line="593" selection-start-column="58" selection-end-line="593" selection-end-column="58" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/wgbodan.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="198">
+          <caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/wangqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-846">
+          <caret line="32" column="16" selection-start-line="32" selection-start-column="16" selection-end-line="32" selection-end-column="16" />
+          <folding>
+            <element signature="e#48#59#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/requirements.txt">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-480" />
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/jianting.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="324">
+          <caret line="18" column="14" lean-forward="true" selection-start-line="18" selection-start-column="14" selection-end-line="18" selection-end-column="14" />
+          <folding>
+            <element signature="e#0#9#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/liansai.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="23">
+          <caret line="21" column="31" selection-start-line="21" selection-start-column="31" selection-end-line="21" selection-end-column="31" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/items.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-2932">
+          <caret line="50" lean-forward="true" selection-start-line="50" selection-end-line="50" />
+          <folding>
+            <element signature="e#320#1230#0" />
+            <element signature="e#1382#1528#0" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/settings.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="153">
+          <caret line="117" lean-forward="true" selection-start-line="117" selection-end-line="117" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="72">
+          <caret line="130" column="37" lean-forward="true" selection-start-line="130" selection-start-column="37" selection-end-line="130" selection-end-column="37" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/pipelines.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="265">
+          <caret line="392" column="50" lean-forward="true" selection-start-line="392" selection-start-column="50" selection-end-line="392" selection-end-column="50" />
+          <folding>
+            <element signature="e#193#208#0" expanded="true" />
+            <element signature="e#18330#19014#0" />
+            <element signature="e#25714#29974#0" />
+            <element signature="e#34571#39061#0" />
+            <element signature="e#39126#43615#0" />
+            <element signature="e#43680#48166#0" />
+            <element signature="e#48346#53071#0" />
+            <element signature="e#53251#58051#0" />
+            <element signature="e#58092#58573#0" />
+            <element signature="e#58725#74468#0" />
+            <element signature="e#74621#82064#0" />
+            <element signature="e#82218#92209#0" />
+            <element signature="e#92365#99910#0" />
+            <element signature="e#100064#109753#0" />
+            <element signature="e#115021#121360#0" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/main.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="234">
+          <caret line="13" lean-forward="true" selection-start-line="13" selection-end-line="13" />
+          <folding>
+            <element signature="e#0#10#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+  </component>
+</project>

+ 2 - 0
new_hg3535s/hg3535/__init__.py

@@ -0,0 +1,2 @@
+import pymysql
+pymysql.install_as_MySQLdb()

二進制
new_hg3535s/hg3535/__pycache__/__init__.cpython-36.pyc


二進制
new_hg3535s/hg3535/__pycache__/items.cpython-36.pyc


二進制
new_hg3535s/hg3535/__pycache__/middlewares.cpython-36.pyc


二進制
new_hg3535s/hg3535/__pycache__/pipelines.cpython-36.pyc


二進制
new_hg3535s/hg3535/__pycache__/settings.cpython-36.pyc


+ 252 - 0
new_hg3535s/hg3535/items.py

@@ -0,0 +1,252 @@
+# -*- coding: utf-8 -*-
+
+# Define here the models for your scraped items
+#
+# See documentation in:
+# https://doc.scrapy.org/en/latest/topics/items.html
+
+import scrapy
+
+
+# 篮球------------------------------------------------------------------------------------------------------------------
+class Lanqiu(scrapy.Field):
+    # 联赛id
+    league_id = scrapy.Field()
+    # 联赛名
+    league_name = scrapy.Field()
+    result = scrapy.Field()
+    # 比赛id
+    game_id = scrapy.Field()
+    # 球队1
+    team_home = scrapy.Field()
+    # 球队2
+    team_guest = scrapy.Field()
+    # 数量(97>)
+    number = scrapy.Field()
+    # 比赛状态
+    zhuangtai = scrapy.Field()
+    # 日期
+    data_game = scrapy.Field()
+    # 开赛时间
+    time_game = scrapy.Field()
+    # 队1分数
+    score_home = scrapy.Field()
+    # 队2分数
+    score_guest = scrapy.Field()
+    # 第几节
+    jijie = scrapy.Field()
+    # 球队得分
+    qiudui = scrapy.Field()
+    pt = scrapy.Field()
+    concede = scrapy.Field()
+    concede_rule = scrapy.Field()
+    odd_even = scrapy.Field()
+    odd_even_rule = scrapy.Field()
+    total_size = scrapy.Field()
+    total_size_rule = scrapy.Field()
+    last_number = scrapy.Field()
+    capot = scrapy.Field()
+    team_score = scrapy.Field()
+    team_score_rule = scrapy.Field()
+
+
+# 联赛---------------------------------------------------------------------------------------------------------------
+class Liansai(scrapy.Field):
+    area_id = scrapy.Field()
+    area_name = scrapy.Field()
+    st_league = scrapy.Field()
+    name_chinese = scrapy.Field()
+    ball = scrapy.Field()
+
+
+# 冠军--------------------------------------------------------------------------------------------------------------
+class Guanjun(scrapy.Field):
+    league_name = scrapy.Field()
+    tema_home = scrapy.Field()
+    league_id = scrapy.Field()
+    game_id = scrapy.Field()
+    data_game = scrapy.Field()
+    time_game = scrapy.Field()
+    new_league_name = scrapy.Field()
+    champion_team = scrapy.Field()
+    new_champion = scrapy.Field()
+    pt = scrapy.Field()
+    ball = scrapy.Field()
+    zhuangtai = scrapy.Field()
+    champion = scrapy.Field()
+
+
+# 足球 --------------------------------------------------------------------------------------------------------------
+class Zuqiu(scrapy.Field):
+    league_id = scrapy.Field()
+    league_name = scrapy.Field()
+    game_id = scrapy.Field()
+    team_home = scrapy.Field()
+    team_guest = scrapy.Field()
+    number = scrapy.Field()
+    data_game = scrapy.Field()
+    time_game = scrapy.Field()
+    half_way = scrapy.Field()
+    pt = scrapy.Field()
+    corner_ball = scrapy.Field()
+    zhuangtai = scrapy.Field()
+    # 球队进球大小
+    full_data = scrapy.Field()
+    half_data = scrapy.Field()
+    full_data_rule = scrapy.Field()
+    half_data_rule = scrapy.Field()
+    # 足球 大小盘
+    half_size_guest = scrapy.Field()
+    half_size_guest_rule = scrapy.Field()
+    half_size_home = scrapy.Field()
+    half_size_home_rule = scrapy.Field()
+
+    size_guest = scrapy.Field()
+    size_guest_rule = scrapy.Field()
+    size_home = scrapy.Field()
+    size_home_rule = scrapy.Field()
+    # 足球 让球&大小盘
+    half_concede_home_rule = scrapy.Field()
+    half_concede_home = scrapy.Field()
+    half_concede_guest_rule = scrapy.Field()
+    half_concede_guest = scrapy.Field()
+    # 足球 独赢
+    concede_guest = scrapy.Field()
+    concede_guest_rule = scrapy.Field()
+    concede_home = scrapy.Field()
+    concede_home_rule = scrapy.Field()
+    # 独赢
+    half_capot_home = scrapy.Field()
+    half_capot_guest = scrapy.Field()
+    half_capot_dogfall = scrapy.Field()
+    capot_home = scrapy.Field()
+    capot_guest = scrapy.Field()
+    capot_dogfall = scrapy.Field()
+    # 足球 入球数单双
+    odd_even_odd = scrapy.Field()
+    odd_even_even = scrapy.Field()
+    half_odd_even_odd = scrapy.Field()
+    half_odd_even_even = scrapy.Field()
+    # 足球 半场/全场
+    half_full = scrapy.Field()
+    # 足球 总入球
+    total_goal = scrapy.Field()
+    # 足球 波胆
+    bodan_data = scrapy.Field()
+    # 足球 最先进球/最后进球
+    first_last_ball = scrapy.Field()
+
+
+# 网球 让球&大小盘--------------------------------------------------------------------------------------------------------
+class Wangqiu(scrapy.Field):
+    # 联赛id
+    league_id = scrapy.Field()
+    # 联赛名
+    league_name = scrapy.Field()
+    result = scrapy.Field()
+    # 比赛id
+    game_id = scrapy.Field()
+    # 球队1
+    team_home = scrapy.Field()
+    # 球队2
+    team_guest = scrapy.Field()
+    # 数量(97>)
+    number = scrapy.Field()
+    # 比赛状态
+    zhuangtai = scrapy.Field()
+    # 日期
+    data_game = scrapy.Field()
+    # 开赛时间
+    time_game = scrapy.Field()
+    # 队1分数
+    score_home = scrapy.Field()
+    # 队2分数
+    score_guest = scrapy.Field()
+    # 第几节
+    jijie = scrapy.Field()
+    # 球队得分
+    qiudui = scrapy.Field()
+    pt = scrapy.Field()
+
+    concedes_dict = scrapy.Field()
+    concedes_dict_rule = scrapy.Field()
+    kemps_dict = scrapy.Field()
+    bureaus_dict = scrapy.Field()
+    bureaus_dict_rule = scrapy.Field()
+    total_number_dict = scrapy.Field()
+    total_number_dict_rule = scrapy.Field()
+    odd_evens_dict = scrapy.Field()
+    odd_evens_dict_rule = scrapy.Field()
+
+
+# 网球 波胆--------------------------------------------------------------------------------------------------------------
+class Wqbodan(scrapy.Field):
+    # 联赛id
+    league_id = scrapy.Field()
+    # 联赛名
+    league_name = scrapy.Field()
+    result = scrapy.Field()
+    # 比赛id
+    game_id = scrapy.Field()
+    # 球队1
+    team_home = scrapy.Field()
+    # 球队2
+    team_guest = scrapy.Field()
+    # 数量(97>)
+    number = scrapy.Field()
+    # 比赛状态
+    zhuangtai = scrapy.Field()
+    # 日期
+    data_game = scrapy.Field()
+    # 开赛时间
+    time_game = scrapy.Field()
+    # 队1分数
+    score_home = scrapy.Field()
+    # 队2分数
+    score_guest = scrapy.Field()
+    # 第几节
+    jijie = scrapy.Field()
+    # 球队得分
+    qiudui = scrapy.Field()
+    pt = scrapy.Field()
+    bodan_data = scrapy.Field()
+
+
+# 棒球 让球 大小---------------------------------------------------------------------------------------------------------
+class Bangqiu(scrapy.Field):
+    # 联赛id
+    league_id = scrapy.Field()
+    # 联赛名
+    league_name = scrapy.Field()
+    result = scrapy.Field()
+    # 比赛id
+    game_id = scrapy.Field()
+    # 球队1
+    team_home = scrapy.Field()
+    # 球队2
+    team_guest = scrapy.Field()
+    # 数量(97>)
+    number = scrapy.Field()
+    # 比赛状态
+    zhuangtai = scrapy.Field()
+    # 日期
+    data_game = scrapy.Field()
+    # 开赛时间
+    time_game = scrapy.Field()
+    # 队1分数
+    score_home = scrapy.Field()
+    # 队2分数
+    score_guest = scrapy.Field()
+    # 第几节
+    jijie = scrapy.Field()
+    # 球队得分
+    qiudui = scrapy.Field()
+    pt = scrapy.Field()
+    concedes_dict = scrapy.Field()
+    concedes_dict_rule = scrapy.Field()
+    capots_dict = scrapy.Field()
+    total_size_dict = scrapy.Field()
+    total_size_dict_rule = scrapy.Field()
+    odd_evens_dict = scrapy.Field()
+    odd_evens_dict_rule = scrapy.Field()
+

+ 45 - 0
new_hg3535s/hg3535/jianting.py

@@ -0,0 +1,45 @@
+import os
+import glob
+
+
+def search_file(file_path, file):
+    # file_path指定路径, file指定文件名
+    path = file_path
+    file_list = []
+    for root, dirs, files in os.walk(path):
+        file_pattern = os.path.join(root, file)
+        for f in glob.glob(file_pattern):
+            file_list.append(f)
+    return file_list
+
+
+def into(f):
+    pass
+    # with open(f, 'wb') as i:
+    #     pass
+        # f = str.encode(f)
+        # i.write(f)
+
+
+def func(file_list):
+    if not file_list:
+        print("没有这个文件")
+    else:
+        print("一共找出 %d 个文件" % len(file_list))
+        print("找出的文件如下: ")
+        for f in file_list:
+            print(f)
+            into(f)
+            # with open(f, 'wb') as i:
+            #     f = str.encode(f)
+            #     i.write(f)
+
+    print('查找文件结束')
+
+
+
+if __name__ == '__main__':
+    file_path = r'C:\Users\admin\Desktop\newscore'
+    file = 'id_json.txt'
+    file_list = search_file(file_path, file)
+    func(file_list)

+ 13 - 0
new_hg3535s/hg3535/main.py

@@ -0,0 +1,13 @@
+import sys
+import os
+from scrapy.cmdline import execute
+
+# print(os.path.dirname(os.path.abspath(__file__)))
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
+# execute(["scrapy", "crawl", "liansai"])
+# execute(["scrapy", "crawl", "zuqiu"])
+# execute(["scrapy", "crawl", "lanqiu"])
+execute(["scrapy", "crawl", "guanjun"])
+# execute(["scrapy", "crawl", "wangqiu"])
+# execute(["scrapy", "crawl", "wqbodan"])
+# execute(["scrapy", "crawl", "bangqiu"])

+ 104 - 0
new_hg3535s/hg3535/middlewares.py

@@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-
+
+# Define here the models for your spider middleware
+#
+# See documentation in:
+# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
+
+from scrapy import signals
+
+
+class Hg3535SpiderMiddleware(object):
+    # Not all methods need to be defined. If a method is not defined,
+    # scrapy acts as if the spider middleware does not modify the
+    # passed objects.
+
+    @classmethod
+    def from_crawler(cls, crawler):
+        # This method is used by Scrapy to create your spiders.
+        s = cls()
+        crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
+        return s
+
+    def process_spider_input(self, response, spider):
+
+        # Called for each response that goes through the spider
+        # middleware and into the spider.
+
+        # Should return None or raise an exception.
+        return None
+
+    def process_spider_output(self, response, result, spider):
+        # Called with the results returned from the Spider, after
+        # it has processed the response.
+
+        # Must return an iterable of Request, dict or Item objects.
+        for i in result:
+            yield i
+
+    def process_spider_exception(self, response, exception, spider):
+        # Called when a spider or process_spider_input() method
+        # (from other spider middleware) raises an exception.
+
+        # Should return either None or an iterable of Response, dict
+        # or Item objects.
+        pass
+
+    def process_start_requests(self, start_requests, spider):
+        # Called with the start requests of the spider, and works
+        # similarly to the process_spider_output() method, except
+        # that it doesn’t have a response associated.
+
+        # Must return only requests (not items).
+        for r in start_requests:
+            yield r
+
+    def spider_opened(self, spider):
+        spider.logger.info('Spider opened: %s' % spider.name)
+
+
+class Hg3535DownloaderMiddleware(object):
+    # Not all methods need to be defined. If a method is not defined,
+    # scrapy acts as if the downloader middleware does not modify the
+    # passed objects.
+
+    @classmethod
+    def from_crawler(cls, crawler):
+        # This method is used by Scrapy to create your spiders.
+        s = cls()
+        crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
+        return s
+
+    def process_request(self, request, spider):
+        # Called for each request that goes through the downloader
+        # middleware.
+
+        # Must either:
+        # - return None: continue processing this request
+        # - or return a Response object
+        # - or return a Request object
+        # - or raise IgnoreRequest: process_exception() methods of
+        #   installed downloader middleware will be called
+        return None
+
+    def process_response(self, request, response, spider):
+        # Called with the response returned from the downloader.
+
+        # Must either;
+        # - return a Response object
+        # - return a Request object
+        # - or raise IgnoreRequest
+        return response
+
+    def process_exception(self, request, exception, spider):
+        # Called when a download handler or a process_request()
+        # (from other downloader middleware) raises an exception.
+
+        # Must either:
+        # - return None: continue processing this exception
+        # - return a Response object: stops process_exception() chain
+        # - return a Request object: stops process_exception() chain
+        pass
+
+    def spider_opened(self, spider):
+        spider.logger.info('Spider opened: %s' % spider.name)

+ 0 - 0
new_hg3535s/hg3535/pip


+ 1802 - 0
new_hg3535s/hg3535/pipelines.py

@@ -0,0 +1,1802 @@
+# -*- coding: utf-8 -*-
+
+# Define your item pipelines here
+#
+# Don't forget to add your pipeline to the ITEM_PIPELINES setting
+# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
+import datetime
+import time
+import hashlib
+
+
+import redis
+from twisted.enterprise import adbapi
+import psycopg2.extras
+
+
+# conn = psycopg2.connect(host='localhost', port=5433, user='postgres', password='123456', database='postgres')
+
+# conn = psycopg2.connect(host='localhost', port=10432, user='kaiyou', password='123456', database='kaiyou')
+
+# class MySnow:
+#     def __init__(self,dataID):
+#         self.start = int(time.mktime(time.strptime('2018-01-01 00:00:00', "%Y-%m-%d %H:%M:%S")))
+#         self.last = int(time.time())
+#         self.countID = 0
+#         self.dataID = dataID    # 数据ID,这个自定义或是映射
+#
+#     def get_id(self):
+#         # 时间差部分
+#         now = int(time.time())
+#         temp = now-self.start
+#         if len(str(temp)) < 9:  # 时间差不够9位的在前面补0
+#             length = len(str(temp))
+#             s = "0" * (9-length)
+#             temp = s + str(temp)
+#         if now == self.last:
+#             self.countID += 1   # 同一时间差,序列号自增
+#         else:
+#             self.countID = 0    # 不同时间差,序列号重新置为0
+#             self.last = now
+#         # 标识ID部分
+#         if len(str(self.dataID)) < 2:
+#             length = len(str(self.dataID))
+#             s = "0" * (2-length)
+#             self.dataID = s + str(self.dataID)
+#         # 自增序列号部分
+#         if self.countID == 99999:  # 序列号自增5位满了,睡眠一秒钟
+#             time.sleep(1)
+#         countIDdata = str(self.countID)
+#         if len(countIDdata) < 5:  # 序列号不够5位的在前面补0
+#             length = len(countIDdata)
+#             s = "0"*(5-length)
+#             countIDdata = s + countIDdata
+#         id = str(temp) + str(self.dataID) + countIDdata
+#         return id
+
+
+# 生成哈希索引 sole
+def hash_func(match_id, odds_code, sort, p_id, pt):
+    m = hashlib.md5()
+    a = str(match_id) + str(odds_code) + str(sort) + str(p_id) + str(pt)
+    m.update(a.encode('utf-8'))
+    c = m.hexdigest()
+    return c
+
+
+# 生成odds_only哈希
+def r_func(match_id, odds_code, sort, p_id, pt, odd):
+    m = hashlib.md5()
+    a = str(match_id) + str(odds_code) + str(sort) + str(p_id) + str(pt) + str(odd)
+    m.update(a.encode('utf-8'))
+    c = m.hexdigest()
+    return c
+
+
+# 转换成本地时间
+def new_time(ctime):
+    time1 = time.mktime(time.strptime(ctime, '%Y-%m-%d %H:%M:%S')) + 43200
+    time2 = time.localtime(time1)
+    time3 = time.strftime('%Y-%m-%d %H:%M:%S', time2)
+    time4 = time3
+    data_time = str(time4).split(" ")
+    match_date = data_time[0]
+    match_time = data_time[1]
+    return match_date, match_time, time3
+
+
+def out_time(ctime, i):
+    ctime1 = datetime.datetime.strptime(ctime, "%Y-%m-%d %H:%M:%S")
+    n_ctime = (ctime1 + datetime.timedelta(hours=i)).strftime("%Y-%m-%d %H:%M:%S")
+    return n_ctime
+
+
+# 篮球插入赔率 -----------------------------------------------------------------------------------------------------------
+def one_intodb(data1, data2, data3, cursor, redis_db):
+    if data1:
+        for key, value in data1.items():
+            if value:
+                for x, y in enumerate(value):
+                    new_hash = hash_func(match_id=data2['game_id'], odds_code=key, sort=x, p_id=data2['p_id'],
+                                         pt=data2['pt'])
+                    r_hash = r_func(match_id=data2['game_id'], odds_code=key, sort=x, p_id=data2['p_id'],
+                                    pt=data2['pt'], odd=y)
+                    odds_only = r_hash
+                    if redis_db.hexists("hg3535_lanqiu", r_hash):
+                        pass
+                    else:
+                        redis_db.hset("hg3535_lanqiu", r_hash, 0)
+                        if data2['pt'] == 1:
+                            sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                            cursor.execute(sql1, (
+                                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], y,
+                                data2['p_id'], data2["p_code"], x, data2["source"], new_hash,
+                                data3[key][x], data2['expire_time'], odds_only,1, data2['utime'], y, data2['expire_time'],
+                                odds_only,data3[key][x]))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
+                            cursor.execute(sql2, (
+                                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], y,
+                                data2['p_id'], data2["p_code"], x, data2["source"], data3[key][x], odds_only,1))
+                        elif data2['pt'] == 2:
+                            sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                            cursor.execute(sql1, (
+                                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], y,
+                                data2['p_id'], data2["p_code"], x, data2["source"], new_hash,
+                                data3[key][x], data2['expire_time'], odds_only,1, data2['utime'], y, data2['expire_time'],
+                                odds_only,data3[key][x]))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
+                            cursor.execute(sql2, (
+                                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], y,
+                                data2['p_id'], data2["p_code"], x, data2["source"], data3[key][x], odds_only,1))
+                        elif data2['pt'] == 3:
+                            sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                            cursor.execute(sql1, (
+                                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], y,
+                                data2['p_id'], data2["p_code"], x, data2["source"], new_hash,
+                                data3[key][x], data2['expire_time'], odds_only,1, data2['utime'], y, data2['expire_time'],
+                                odds_only,data3[key][x]))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
+                            cursor.execute(sql2, (
+                                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], y,
+                                data2['p_id'], data2["p_code"], x, data2["source"], data3[key][x], odds_only,1))
+
+
+def two_intodb(data1, data2, data3, cursor, redis_db):
+    if data1:
+        for key, value in data1.items():
+            if value:
+                new_hash = hash_func(match_id=data2['game_id'], odds_code=data3 + key, sort=data2['sort'], p_id=data2['p_id'],
+                                     pt=data2['pt'])
+
+                r_hash = r_func(match_id=data2['game_id'], odds_code=data3 + key, sort=data2['sort'], p_id=data2['p_id'],
+                                pt=data2['pt'], odd=value)
+                odds_only = r_hash
+                if redis_db.hexists("hg3535_lanqiu", r_hash):
+                    pass
+                else:
+                    redis_db.hset("hg3535_lanqiu", r_hash, 0)
+                    if data2['pt'] == 1:
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_today) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            key, data2['expire_time'], odds_only,1, data2['utime'], value, data2['expire_time'], odds_only,key))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_today) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], key, odds_only,1))
+                    if data2['pt'] == 2:
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_morningplate) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            key, data2['expire_time'], odds_only,1, data2['utime'], value, data2['expire_time'], odds_only,key))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_morningplate) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], key, odds_only,1))
+                    if data2['pt'] == 3:
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_stringscene) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            key, data2['expire_time'], odds_only,1, data2['utime'], value, data2['expire_time'], odds_only,key))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_stringscene) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], key, odds_only,1))
+
+
+def three_intodb(data1, data2, cursor, redis_db):
+    if data1:
+        for key, value in data1.items():
+            if value:
+                new_hash = hash_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'],
+                                     pt=data2['pt'])
+
+                r_hash = r_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'],
+                                pt=data2['pt'], odd=value)
+                odds_only = r_hash
+                if redis_db.hexists("hg3535_lanqiu", r_hash):
+                    pass
+                else:
+                    redis_db.hset("hg3535_lanqiu", r_hash, 0)
+                    if data2['pt'] == 1:
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash, data2['expire_time'],
+                            odds_only, 1, data2['utime'], value, data2['expire_time'], odds_only))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], odds_only, 1))
+                    if data2['pt'] == 2:
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash, data2['expire_time'],
+                            odds_only, 1, data2['utime'], value, data2['expire_time'], odds_only))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], odds_only, 1))
+                    if data2['pt'] == 3:
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash, data2['expire_time'],
+                            odds_only, 1, data2['utime'], value, data2['expire_time'], odds_only))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], odds_only, 1))
+
+
+# 插入篮球赛事表
+def into_competition(data, cursor):
+    Competition_sql = "insert into st_lq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time, ctime, utime, tag, type, source,expire_time,is_today,is_morningplate,is_stringscene) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s, %s, %s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s,is_morningplate=%s,is_stringscene=%s;"
+    cursor.execute(Competition_sql, (
+        data['team_home'], data['team_guest'], data['league_id'], data['game_id'], data['match_date'],
+        data['match_time'],
+        data['utime'], data['utime'], data['number'], data['pt'], data["source"], data['expire_time'], data['is_today'],
+        data['is_morningplate'], data['is_stringscene'], data['number'], data['expire_time'], data['is_today'],
+        data['is_morningplate'], data['is_stringscene']))
+
+
+# 插入足球赛事表----------------------------------------------------------------------------------------------------------
+def zqone_competition(data, cursor):
+    Competition_sql = "insert into st_zq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time, ctime, utime, tag,source, expire_time,is_today,us_time) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s,%s,%s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s,us_time=%s;"
+    cursor.execute(Competition_sql, (
+        data['team_home'], data['team_guest'], data['league_id'], data['game_id'], data['match_date'],
+        data['match_time'],
+        data['utime'], data['utime'], data['number'], data["source"], data['expire_time'], data['is_today'],
+        data['us_time'], data['number'], data['expire_time'], data['is_today'],data['us_time']))
+
+
+def zqtwo_competition(data, cursor):
+    Competition_sql = "insert into st_zq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time, ctime, utime, tag,source, expire_time,is_morningplate,us_time) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s,%s,%s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_morningplate=%s,us_time=%s;"
+    cursor.execute(Competition_sql, (
+        data['team_home'], data['team_guest'], data['league_id'], data['game_id'], data['match_date'],
+        data['match_time'],
+        data['utime'], data['utime'], data['number'], data["source"], data['expire_time'], data['is_morningplate'],
+        data['us_time'], data['number'], data['expire_time'], data['is_morningplate'],data['us_time']))
+
+
+def zqthree_competition(data, cursor):
+    Competition_sql = "insert into st_zq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time, ctime, utime, tag,source, expire_time,is_stringscene,us_time) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_stringscene=%s,us_time=%s;"
+    cursor.execute(Competition_sql, (
+        data['team_home'], data['team_guest'], data['league_id'], data['game_id'], data['match_date'],
+        data['match_time'],
+        data['utime'], data['utime'], data['number'], data["source"], data['expire_time'], data['is_stringscene'],
+        data['us_time'], data['number'], data['expire_time'], data['is_stringscene'],data['us_time']))
+
+
+# 足球 插入赔率 让球 大小-------------------------------------------------------------------------------------------------
+def zqone_intodb(data1, data2, data3, data4, cursor, redis_db):
+    if data1:
+        for index, value in enumerate(data1):
+            if value:
+                new_hash = hash_func(match_id=data2['game_id'], odds_code=data3, sort=index, p_id=data2['p_id'], pt=data2['pt'])
+                r_hash = r_func(match_id=data2['game_id'], odds_code=data3, sort=index, p_id=data2['p_id'], pt=data2['pt'], odd=value)
+                odds_only = r_hash
+                if redis_db.hexists("hg3535_zuqiu", r_hash):
+                    pass
+                else:
+                    redis_db.hset("hg3535_zuqiu", r_hash, 0)
+                    if data2['pt'] == 1:
+                        sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_today) values (%s,%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], index, data2["source"], new_hash,
+                            data4[index], data2['expire_time'], odds_only, 1, data2['utime'], value, data2['expire_time'],
+                            odds_only,data4[index]))
+
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], float(value),
+                            data2['p_id'], data2["p_code"], index, data2["source"], data4[index], odds_only,1))
+                    elif data2['pt'] == 2:
+                        sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_morningplate) values (%s,%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'],
+                            float(value),
+                            data2['p_id'], data2["p_code"], index, data2["source"], new_hash,
+                            data4[index], data2['expire_time'], odds_only, 1, data2['utime'], value,
+                            data2['expire_time'],
+                            odds_only, data4[index]))
+
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'],
+                            float(value),
+                            data2['p_id'], data2["p_code"], index, data2["source"], data4[index], odds_only,1))
+                    elif data2['pt'] == 3:
+                        sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_stringscene) values (%s,%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'],
+                            float(value),
+                            data2['p_id'], data2["p_code"], index, data2["source"], new_hash,
+                            data4[index], data2['expire_time'], odds_only,1, data2['utime'], value,
+                            data2['expire_time'],
+                            odds_only, data4[index]))
+
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'],
+                            float(value),
+                            data2['p_id'], data2["p_code"], index, data2["source"], data4[index], odds_only,1))
+
+
+# 足球 插入赔率  独赢 单双
+def zqtwo_intodb(data1, data2, data3, data4, cursor, redis_db):
+    if data1:
+        new_hash = hash_func(match_id=data2['game_id'], odds_code=data3, sort=data2['sort'], p_id=data2['p_id'],pt=data2['pt'])
+        r_hash = r_func(match_id=data2['game_id'], odds_code=data3, sort=data2['sort'], p_id=data2['p_id'], pt=data2['pt'],
+                        odd=data1)
+        odds_only = r_hash
+        if redis_db.hexists("hg3535_zuqiu", r_hash):
+            pass
+        else:
+            redis_db.hset("hg3535_zuqiu", r_hash, 0)
+            if data2['pt'] == 1:
+                sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time, odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                cursor.execute(sql1, (
+                    int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], data1,
+                    data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                    data4, data2['expire_time'], odds_only, 1, data2['utime'], data1, data2['expire_time'], odds_only,data4))
+                # 更新主队st_zq_odds_record表
+                sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only, is_today) values (%s,%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                cursor.execute(sql2, (
+                    int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], data1,
+                    data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data4, odds_only, 1))
+            if data2['pt'] == 2:
+                sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time, odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                cursor.execute(sql1, (
+                    int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], data1,
+                    data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                    data4, data2['expire_time'], odds_only, 1, data2['utime'], data1, data2['expire_time'], odds_only,data4))
+                # 更新主队st_zq_odds_record表
+                sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only, is_morningplate) values (%s,%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                cursor.execute(sql2, (
+                    int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], data1,
+                    data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data4, odds_only, 1))
+            if data2['pt'] == 3:
+                sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time, odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                cursor.execute(sql1, (
+                    int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], data1,
+                    data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                    data4, data2['expire_time'], odds_only, 1, data2['utime'], data1, data2['expire_time'], odds_only,data4))
+                # 更新主队st_zq_odds_record表
+                sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only, is_stringscene) values (%s,%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                cursor.execute(sql2, (
+                    int(data2['league_id']), data3, int(data2['game_id']), data2['utime'], data2['utime'], data1,
+                    data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data4, odds_only, 1))
+
+
+def gjz_into(data, cursor, r_hash, s_hash, redis_db, pt):
+    if redis_db.hexists('hg3535_guanjun', r_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_guanjun', r_hash, 0)
+        if pt == 1:
+            sql = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']), )
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+        if pt == 2:
+            sql = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+        if pt == 3:
+            sql = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+    if redis_db.hexists('hg3535_liansai', s_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_liansai', s_hash, 0)
+        league_sql = "insert into st_zq_league(name_chinese, lg_id,last_time) values (%s, %s, %s) on conflict(lg_id) do update set last_time = %s,source=%s;"
+        cursor.execute(league_sql, (data['league_name'], data['league_id'], data['time3'], data['time3'], "hg3535"))
+
+
+def gjl_into(data, cursor, r_hash, s_hash, redis_db, pt):
+    if redis_db.hexists('hg3535_guanjun', r_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_guanjun', r_hash, 0)
+        if pt == 1:
+            sql = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+        if pt == 2:
+            sql = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+        if pt == 3:
+            sql = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+
+    # 插入st_zq_league表
+    if redis_db.hexists('hg3535_liansai', s_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_liansai', s_hash, 0)
+        league_sql = "insert into st_lq_league(name_chinese, lg_id,last_time) values (%s, %s, %s) on conflict(lg_id) do update set last_time = %s,source=%s;"
+        cursor.execute(league_sql, (data['league_name'], data['league_id'], data['time3'], data['time3'], "hg3535"))
+
+
+def gjw_into(data, cursor, r_hash, s_hash, redis_db, pt):
+    if redis_db.hexists('hg3535_guanjun', r_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_guanjun', r_hash, 0)
+        if pt == 1:
+            sql = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+        if pt == 2:
+            sql = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+        if pt == 3:
+            sql = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'], 1))
+    # 插入st_zq_league表
+    if redis_db.hexists('hg3535_liansai', s_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_liansai', s_hash, 0)
+        league_sql = "insert into st_wq_league(name_chinese, lg_id,last_time) values (%s, %s, %s) on conflict(lg_id) do update set last_time = %s,source=%s;"
+        cursor.execute(league_sql, (data['league_name'], data['league_id'], data['time3'], data['time3'], "hg3535"))
+
+
+def gjb_into(data, cursor, r_hash, s_hash, redis_db, pt):
+    if redis_db.hexists('hg3535_guanjun', r_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_guanjun', r_hash, 0)
+        if pt == 1:
+            sql = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'],1))
+        if pt == 2:
+            sql = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'],1))
+        if pt == 3:
+            sql = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, team, type, source, sole, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s,expire_time=%s,odds_only=%s;"
+            cursor.execute(sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['new_hash'], data['expire_time'], data['odds_only'],1, data['utime'],
+                data['champion_team'], data['expire_time'], data['odds_only']))
+            # 插入st_zq_odds_record表
+            new_sql = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, team, type, source,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s)"
+            cursor.execute(new_sql, (
+                int(data['league_id']), data['new_champion'], int(data['game_id']), data['utime'], data['utime'],
+                data['champion_team'], data['p_id'], data['new_league_name'],
+                data['tema_home'], 1, "hg3535", data['odds_only'],1))
+    # 插入st_zq_league表
+    if redis_db.hexists('hg3535_liansai', s_hash):
+        pass
+    else:
+        redis_db.hset('hg3535_liansai', s_hash, 0)
+        league_sql = "insert into st_bq_league(name_chinese, lg_id,last_time) values (%s, %s, %s) on conflict(lg_id) do update set last_time = %s,source=%s;"
+        cursor.execute(league_sql, (data['league_name'], data['league_id'], data['time3'], data['time3'], "hg3535"))
+
+
+# 网球 插入赔率----------------------------------------------------------------------------------------------------------
+def wqone_intodb(data1, data2, data3, cursor, redis_db):
+    if data1:
+        for key, value in data1.items():
+            if value:
+                new_hash = hash_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'],pt=data2['pt'])
+
+                r_hash = r_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'], pt=data2['pt'], odd=value)
+                odds_only = r_hash
+                if redis_db.hexists("hg3535_wangqiu", r_hash):
+                    pass
+                else:
+                    redis_db.hset("hg3535_wangqiu", r_hash, 0)
+                    if data2['pt'] == 1:
+                        sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            data3[key], data2['expire_time'], odds_only,1, data2['utime'], value, data2['expire_time'],
+                            odds_only,data3[key]))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data3[key], odds_only,1))
+                    if data2['pt'] == 2:
+                        sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            data3[key], data2['expire_time'], odds_only,1, data2['utime'], value, data2['expire_time'],
+                            odds_only,data3[key]))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data3[key], odds_only,1))
+                    if data2['pt'] == 3:
+                        sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            data3[key], data2['expire_time'], odds_only,1, data2['utime'], value, data2['expire_time'],
+                            odds_only,data3[key]))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data3[key], odds_only,1))
+
+
+# 棒球 插入赔率----------------------------------------------------------------------------------------------------------
+def bqone_intodb(data1, data2, data3, cursor, redis_db):
+    if data1:
+        for key, value in data1.items():
+            if value:
+                new_hash = hash_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'],
+                                     pt=data2['pt'])
+                r_hash = r_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'],
+                                pt=data2['pt'], odd=value)
+                odds_only = r_hash
+                if redis_db.hexists("hg3535_bangqiu", r_hash):
+                    pass
+                else:
+                    redis_db.hset("hg3535_bangqiu", r_hash, 0)
+                    if data2['pt'] == 1:
+                        sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            data3[key], data2['expire_time'], odds_only, 1,data2['utime'], value,data2['expire_time'],
+                            odds_only, data3[key]))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data3[key], odds_only, 1))
+                    if data2['pt'] == 2:
+                        sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            data3[key], data2['expire_time'], odds_only, 1, data2['utime'], value, data2['expire_time'],
+                            odds_only, data3[key]))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data3[key], odds_only, 1))
+                    if data2['pt'] == 3:
+                        sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_stringscene) values (%s,%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s,condition=%s;"
+                        cursor.execute(sql1, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                            data3[key], data2['expire_time'], odds_only, 1, data2['utime'], value, data2['expire_time'],
+                            odds_only, data3[key]))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                        cursor.execute(sql2, (
+                            int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value,
+                            data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data3[key], odds_only, 1))
+
+
+def get_pcode(corner_ball, code):
+    code_dict = {'concede_size': 1, 'capot': 2, 'two_sides': 3, 'total_goal': 4, 'half_full': 5, 'bodan': 6,
+                 'first_last_ball': 7, 'temaball': 11}
+    if corner_ball == "角球":
+        p_code = "corner_ball"
+        p_id = 9
+    elif corner_ball == "会晋级":
+        p_code = "promotion"
+        p_id = 10
+    elif corner_ball == "罚牌数":
+        p_code = "Penalty_card"
+        p_id = 12
+    else:
+        p_code = code
+        p_id = code_dict[code]
+    return p_code, p_id
+
+
+# 足球 赔率 赛事---------------------------------------------------------------------------------------------------------
+class Zuqiupipeline(object):
+    def __init__(self, dbpool, conn, cursor, redis_db):
+        self.dbpool = dbpool
+        self.conn = conn
+        self.cursor = cursor
+        self.redis_db = redis_db
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        conn = psycopg2.connect(host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+        pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"])
+        redis_db = redis.StrictRedis(connection_pool=pool)
+        return cls(dbpool, conn, cursor, redis_db)
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+        # return item
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 比赛日期
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
+        r_ctime = "2019" + "-" + month + "-" + day
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
+        # 比赛id
+        competition_id = item['game_id']
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛name
+        league_name = item['league_name']
+        # 主队
+        team_home = item['team_home']
+        # 客队
+        team_guest = item['team_guest']
+        # number
+        number = item['number']
+        pt = item['pt']
+        corner_ball = item['corner_ball']
+        p_code, p_id = get_pcode(corner_ball, 'concede_size')
+        # 构建唯一索引
+        half_size_guest = item["half_size_guest"]
+        half_size_guest_rule = item["half_size_guest_rule"]
+        half_size_home = item["half_size_home"]
+        half_size_home_rule = item["half_size_home_rule"]
+
+        size_data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id, 'p_code': p_code,
+                     'source': "hg3535", 'expire_time': expire_time, 'pt': pt}
+        # 让球 数据插入数据库
+        zqone_intodb(data1=half_size_home, data2=size_data, data3="half_size_home", data4=half_size_home_rule,
+                     cursor=cursor, redis_db=self.redis_db)
+        # 让球 数据插入数据库
+        zqone_intodb(data1=half_size_guest, data2=size_data, data3="half_size_guest", data4=half_size_guest_rule,
+                     cursor=cursor, redis_db=self.redis_db)
+        # 全场场大小
+        size_guest = item["size_guest"]
+        size_guest_rule = item["size_guest_rule"]
+        size_home = item["size_home"]
+        size_home_rule = item["size_home_rule"]
+        zqone_intodb(data1=size_guest, data2=size_data, data3="size_guest", data4=size_guest_rule,
+                     cursor=cursor, redis_db=self.redis_db)
+        zqone_intodb(data1=size_home, data2=size_data, data3="size_home", data4=size_home_rule,
+                     cursor=cursor, redis_db=self.redis_db)
+        # 上半场大小
+        half_concede_home_rule = item["half_concede_home_rule"]
+        half_concede_home = item["half_concede_home"]
+        half_concede_guest_rule = item["half_concede_guest_rule"]
+        half_concede_guest = item["half_concede_guest"]
+        # 上半场让球
+        zqone_intodb(data1=half_concede_home, data2=size_data, data3="half_concede_home", data4=half_concede_home_rule,
+                     cursor=cursor, redis_db=self.redis_db)
+        zqone_intodb(data1=half_concede_guest, data2=size_data, data3="half_concede_guest", data4=half_concede_guest_rule, cursor=cursor, redis_db=self.redis_db)
+
+        concede_guest = item["concede_guest"]
+        concede_guest_rule = item["concede_guest_rule"]
+        concede_home = item["concede_home"]
+        concede_home_rule = item["concede_home_rule"]
+        # 全场让球
+        zqone_intodb(data1=concede_guest, data2=size_data, data3="concede_guest", data4=concede_guest_rule,
+                     cursor=cursor, redis_db=self.redis_db)
+        zqone_intodb(data1=concede_home, data2=size_data, data3="concede_home", data4=concede_home_rule,
+                     cursor=cursor,redis_db=self.redis_db)
+        #
+        p_code, p_id = get_pcode(corner_ball, 'capot')
+        # 独赢----------------------------------------------------------------------------------------------------------
+        half_capot_home = item["half_capot_home"]
+        half_capot_guest = item["half_capot_guest"]
+        half_capot_dogfall = item["half_capot_dogfall"]
+
+        capot_home = item["capot_home"]
+        capot_guest = item["capot_guest"]
+        capot_dogfall = item["capot_dogfall"]
+        capot_data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id, 'p_code': p_code,
+                      'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        # 上半场独赢 主队
+        zqtwo_intodb(data1=half_capot_home, data2=capot_data, data3="half_capot_home", data4='1', cursor=cursor,redis_db=self.redis_db)
+        # 上半场独赢 客队
+        zqtwo_intodb(data1=half_capot_guest, data2=capot_data, data3="half_capot_guest", data4='2', cursor=cursor,redis_db=self.redis_db)
+        # 上半场独赢 和
+        zqtwo_intodb(data1=half_capot_dogfall, data2=capot_data, data3="half_capot_dogfall", data4='x', cursor=cursor,redis_db=self.redis_db)
+        #
+        # 全场独赢 主队
+        zqtwo_intodb(data1=capot_home, data2=capot_data, data3="capot_home", data4='1', cursor=cursor,redis_db=self.redis_db)
+        # 全场独赢 客队
+        zqtwo_intodb(data1=capot_guest, data2=capot_data, data3="capot_guest", data4='2', cursor=cursor,redis_db=self.redis_db)
+        # 全场独赢 和
+        zqtwo_intodb(data1=capot_dogfall, data2=capot_data, data3="capot_dogfall", data4='x', cursor=cursor,redis_db=self.redis_db)
+        #
+# 入球数单双-------------------------------------------------------------------------------------------------------------
+        p_code, p_id = get_pcode(corner_ball, 'two_sides')
+        odd_even_odd = item["odd_even_odd"]
+        odd_even_even = item["odd_even_even"]
+        half_odd_even_odd = item["half_odd_even_odd"]
+        half_odd_even_even = item["half_odd_even_even"]
+        # 全场入球数 单双
+        two_sides_data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id,
+                          'p_code': p_code,
+                          'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        # 上半场入球数 单双
+        zqtwo_intodb(data1=odd_even_odd, data2=two_sides_data, data3="two_sides_single", data4='单', cursor=cursor,redis_db=self.redis_db)
+        zqtwo_intodb(data1=odd_even_even, data2=two_sides_data, data3="two_sides_double", data4='双', cursor=cursor,redis_db=self.redis_db)
+        # 全场入球数 单双
+        zqtwo_intodb(data1=half_odd_even_odd, data2=two_sides_data, data3="half_two_sides_single", data4='单',
+                     cursor=cursor, redis_db=self.redis_db)
+        zqtwo_intodb(data1=half_odd_even_even, data2=two_sides_data, data3="half_two_sides_double", data4='双',
+                     cursor=cursor, redis_db=self.redis_db)
+
+# 总入球数 --------------------------------------------------------------------------------------------------------------
+        p_code, p_id = get_pcode(corner_ball, 'total_goal')
+        total_goals = item['total_goal']
+        total_dict = {'total_goal_zero': '0-1', 'total_goal_two': '2-3', 'total_goal_four': '4-6',
+                      'total_goal_seven': '7或以上', 'half_total_goal_zero': '0', "half_total_goal_one": '1',
+                      "half_total_goal_two": '2', "half_total_goal_three": '3或以上'}
+        # 全场入球数 单双
+        total_goal_data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id,
+                           'p_code': p_code,
+                           'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        # 上半场入球数 单双
+        for key, value in total_goals.items():
+            if value:
+                zqtwo_intodb(data1=value, data2=total_goal_data, data3=key, data4=total_dict[key], cursor=cursor, redis_db=self.redis_db)
+
+# 全场半场 --------------------------------------------------------------------------------------------------------------
+        half_fulls = item['half_full']
+        p_code, p_id = get_pcode(corner_ball, 'half_full')
+        full_dict = {"half_full_home_home": "主主", "half_full_home_dogfall": "主和",
+                     "half_full_home_guest": "主客", "half_full_dogfall_home": "和主",
+                     "half_full_dogfall_dogfall": "和和", "half_full_dogfall_guest": "和客",
+                     "half_full_guest_home": "客主", "half_full_guest_dogfall": "客和",
+                     "half_full_guest_guest": "客客"}
+        half_full_data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id,
+                          'p_code': p_code,
+                          'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        if half_fulls:
+            for key, value in half_fulls.items():
+                if value:
+                    zqtwo_intodb(data1=value, data2=half_full_data, data3=key, data4=full_dict[key], cursor=cursor, redis_db=self.redis_db)
+# 波胆------------------------------------------------------------------------------------------------------------------
+        bodan_datas = item['bodan_data']
+        p_code, p_id = get_pcode(corner_ball, 'bodan')
+        bodan_dict = {"bodanhome_one_zero": "1-0", "bodanhome_two_zero": "2-0",
+                      "bodanhome_two_one": "2-1", "bodanhome_three_zero": "3-0",
+                      "bodanhome_three_one": "3-1", "bodanhome_three_two": "3-2",
+                      "bodanhome_four_zero": "4-0", "bodanhome_four_one": "4-1",
+                      "bodanhome_four_two": "4-2", "bodanhome_four_three": "4-3",
+                      "bodanguest_one_zero": "0-1", "bodanguest_two_zero": "0-2",
+                      "bodanguest_two_one": "1-2", "bodanguest_three_zero": "0-3",
+                      "bodanguest_three_one": "1-3", "bodanguest_three_two": "2-3",
+                      "bodanguest_four_zero": "0-4", "bodanguest_four_one": "1-4",
+                      "bodanguest_four_two": "2-4", "bodanguest_four_three": "3-4",
+                      "bodandogfall_zero_zero": "0-0", "bodandogfall_one_one": "1-1",
+                      "bodandogfall_two_two": "2-2", "bodandogfall_three_three": "3-3",
+                      "bodandogfall_four_four": "4-4", "bodanother": "其他",
+                      "halfbodanhome_one_zero": "1-0", "halfbodanhome_two_zero": "2-0",
+                      "halfbodanhome_two_one": "2-1", "halfbodanhome_three_zero": "3-0",
+                      "halfbodanhome_three_one": "3-1", "halfbodanhome_three_two": "3-2",
+                      "halfbodanguest_one_zero": "0-1", "halfbodanguest_two_zero": "0-2",
+                      "halfbodanguest_two_one": "1-2", "halfbodanguest_three_zero": "0-3",
+                      "halfbodanguest_three_one": "1-3", "halfbodanguest_three_two": "2-3",
+                      "halfbodandogfall_zero_zero": "0-0", "halfbodandogfall_one_one": "1-1",
+                      "halfbodandogfall_two_two": "2-2", "halfbodandogfall_three_three": "3-3",
+                      "halfbodanother": "其他"}
+        bodan_data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id, 'p_code': p_code,
+                      'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        if bodan_datas:
+            for key, value in bodan_datas.items():
+                zqtwo_intodb(data1=value, data2=bodan_data, data3=key, data4=bodan_dict[key], cursor=cursor, redis_db=self.redis_db)
+
+# 最先进球/最后进球 ------------------------------------------------------------------------------------------------------
+        first_last_balls = item['first_last_ball']
+        p_code, p_id = get_pcode(corner_ball, 'first_last_ball')
+        first_last_dict = {"first_last_ball": "最先进球", "first_ball_home": "最先进球", "first_ball_guest": "最先进球",
+                           "last_ball_home": "最后进球", "last_ball_guest": "最后进球", "not_ball": "没有进球"}
+        first_last_data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id,
+                           'p_code': p_code,
+                           'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        if first_last_balls:
+            for key, value in first_last_balls.items():
+                # 构建唯一索引
+                zqtwo_intodb(data1=value, data2=first_last_data, data3=key, data4=first_last_dict[key], cursor=cursor, redis_db=self.redis_db)
+
+        p_code, p_id = get_pcode(corner_ball, 'temaball')
+        full_dicts = item['full_data']
+        half_dicts = item['half_data']
+        full_dict_rules = item['full_data_rule']
+        half_dict_rules = item['half_data_rule']
+        data = {'league_id': league_id, 'game_id': competition_id, 'utime': utime, 'p_id': p_id, 'p_code': p_code,
+                'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        if full_dicts:
+            for key, value in full_dicts.items():
+                zqtwo_intodb(data1=value, data2=data, data3=key, data4=full_dict_rules[key], cursor=cursor, redis_db=self.redis_db)
+
+        if half_dicts:
+            for key, value in half_dicts.items():
+                zqtwo_intodb(data1=value, data2=data, data3=key, data4=half_dict_rules[key], cursor=cursor, redis_db=self.redis_db)
+
+        match_date, match_time, time3 = new_time(ctime)
+        n_time = out_time(time3, 1.5)
+        # 插入st_zq_competition表
+        if pt == 1:
+            data_competition = {'team_home': team_home, 'team_guest': team_guest, 'league_id': league_id,
+                                'game_id': competition_id,
+                                'match_date': match_date, 'match_time': match_time, 'utime': utime, 'number': number,
+                                'source': "hg3535", "expire_time": n_time, 'is_today': 1, "us_time": ctime}
+            zqone_competition(data=data_competition, cursor=cursor)
+        if pt == 2:
+            data_competition = {'team_home': team_home, 'team_guest': team_guest, 'league_id': league_id,
+                                'game_id': competition_id,
+                                'match_date': match_date, 'match_time': match_time, 'utime': utime, 'number': number,
+                                'source': "hg3535", "expire_time": n_time, 'is_morningplate': 1, "us_time": ctime}
+            zqtwo_competition(data=data_competition, cursor=cursor)
+        if pt == 3:
+            data_competition = {'team_home': team_home, 'team_guest': team_guest, 'league_id': league_id,
+                                'game_id': competition_id,
+                                'match_date': match_date, 'match_time': match_time, 'utime': utime, 'number': number,
+                                'source': "hg3535", "expire_time": n_time, "is_stringscene": 1, "us_time": ctime}
+            zqthree_competition(data=data_competition, cursor=cursor)
+
+    def close_spider(self, spider):
+        self.conn.close()
+        self.dbpool.close()
+
+
+# 篮球 让球大小----------------------------------------------------------------------------------------------------------
+class Lanqiupipeline(object):
+    def __init__(self, dbpool, conn, cursor, redis_db):
+        self.dbpool = dbpool
+        self.conn = conn
+        self.cursor = cursor
+        self.redis_db = redis_db
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        conn = psycopg2.connect(host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+        pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"])
+        redis_db = redis.StrictRedis(connection_pool=pool)
+        return cls(dbpool, conn, cursor, redis_db)
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+        # return item
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛名
+        league_name = item['league_name']
+        # result = item['result']
+        # 比赛id
+        game_id = item['game_id']
+        # 球队1
+        team_home = item['team_home']
+        # 球队2
+        team_guest = item['team_guest']
+        # 数量(97>)
+        number = item['number']
+        # 比赛状态
+        zhuangtai = item['zhuangtai']
+        # 日期
+        # data_game = item['data_game']
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
+        r_ctime = "2019" + "-" + month + "-" + day
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
+        # 队1分数
+        score_home = item['score_home']
+        # 队2分数
+        score_guest = item['score_guest']
+        # 第几节
+        jijie = item['jijie']
+        # 球队得分
+        qiudui = item['qiudui']
+        pt = item['pt']
+        concedes_dict = item['concede']
+        concedes_dict_rule = item['concede_rule']
+        odd_evens_dict = item['odd_even']
+        odd_evens_dict_rule = item['odd_even_rule']
+        total_sizes_dict = item['total_size']
+        total_sizes_dict_rule = item['total_size_rule']
+        last_numbers_dict = item['last_number']
+        capots_dict = item['capot']
+        team_scores_dict = item['team_score']
+        team_scores_dict_rule = item['team_score_rule']
+        # 让球
+        concede = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 1, 'p_code': "lq_concede",
+                   'source': "hg3535", 'expire_time': expire_time, 'pt': pt}
+        # 让球 数据插入数据库
+        one_intodb(data1=concedes_dict, data2=concede, data3=concedes_dict_rule, cursor=cursor, redis_db=self.redis_db)
+
+        two_sides = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 2, 'p_code': "lq_two_sides",
+                     'source': "hg3535", 'expire_time': expire_time, 'pt': pt}
+        # 总分单双 数据插入数据库
+        one_intodb(data1=odd_evens_dict, data2=two_sides, data3=odd_evens_dict_rule, cursor=cursor, redis_db=self.redis_db)
+
+        total_size = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 3, 'p_code': "lq_total_size",
+                      'source': "hg3535", 'expire_time': expire_time, 'pt': pt}
+        # 全场总分大小 数据插入数据库
+        one_intodb(data1=total_sizes_dict, data2=total_size, data3=total_sizes_dict_rule, cursor=cursor, redis_db=self.redis_db)
+
+        data4 = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 6, 'p_code': "lq_team_score",
+                 'source': "hg3535", 'expire_time': expire_time,'pt': pt}
+        # 全场总分大小 数据插入数据库
+        one_intodb(data1=team_scores_dict, data2=data4, data3=team_scores_dict_rule, cursor=cursor, redis_db=self.redis_db)
+        # 主队进球最后一位数
+        last_number_home = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 4,
+                            'p_code': "lq_last_number",
+                            'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        two_intodb(data1=last_numbers_dict['lq_last_home'], data2=last_number_home, data3="lq_last_home", cursor=cursor,redis_db=self.redis_db)
+        # 客队进球最后一位数
+        last_number_guest = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 4,
+                             'p_code': "lq_last_number",
+                             'source': "hg3535", 'expire_time': expire_time, 'sort': 0,'pt': pt}
+        two_intodb(data1=last_numbers_dict['lq_last_home'], data2=last_number_guest, data3="lq_last_guest",
+                   cursor=cursor, redis_db=self.redis_db)
+        # 独赢
+        capot_data = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 5, 'p_code': "lq_capot",
+                      'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        three_intodb(data1=capots_dict, data2=capot_data, cursor=cursor, redis_db=self.redis_db)
+        match_date, match_time, time3 = new_time(ctime)
+        n_time = out_time(time3, 1.5)
+        us_time = ctime
+        # 插入赛事表
+
+        if pt == 1:
+            Competition_sql = "insert into st_lq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_today,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+        if pt == 2:
+            Competition_sql = "insert into st_lq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_morningplate,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_morningplate=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+        if pt == 3:
+            Competition_sql = "insert into st_lq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_stringscene,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_stringscene=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+
+    def close_spider(self, spider):
+        self.conn.close()
+        self.dbpool.close()
+
+
+# 网球 让球&大小盘--------------------------------------------------------------------------------------------------------
+class Wangqiupipeline(object):
+    def __init__(self, dbpool, conn, cursor, redis_db):
+        self.dbpool = dbpool
+        self.conn = conn
+        self.cursor = cursor
+        self.redis_db = redis_db
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        conn = psycopg2.connect(host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+        pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"])
+        redis_db = redis.StrictRedis(connection_pool=pool)
+        return cls(dbpool, conn, cursor, redis_db)
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+        # return item
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛名
+        league_name = item['league_name']
+        # result = item['result']
+        # 比赛id
+        game_id = item['game_id']
+        # 球队1
+        team_home = item['team_home']
+        # 球队2
+        team_guest = item['team_guest']
+        # 数量(97>)
+        number = item['number']
+        # 比赛状态
+        zhuangtai = item['zhuangtai']
+        # 日期
+        # data_game = item['data_game']
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
+        r_ctime = "2019" + "-" + month + "-" + day
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
+        # 队1分数
+        score_home = item['score_home']
+        # 队2分数
+        score_guest = item['score_guest']
+        # 第几节
+        jijie = item['jijie']
+        # 球队得分
+        qiudui = item['qiudui']
+        pt = item['pt']
+        # 让盘
+        concedes_dict = item['concedes_dict']
+        concedes_dict_rule = item['concedes_dict_rule']
+        # 冠军
+        kemps_dict = item['kemps_dict']
+        # 让局
+        bureaus_dict = item['bureaus_dict']
+        bureaus_dict_rule = item['bureaus_dict_rule']
+        # 总局数大小
+        total_number_dict = item['total_number_dict']
+        total_number_dict_rule = item['total_number_dict_rule']
+        # 总局数单双
+        odd_evens_dict = item['odd_evens_dict']
+        odd_evens_dict_rule = item['odd_evens_dict_rule']
+
+        # 让球
+        concede = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 1, 'p_code': "wq_concede",
+                   'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        wqone_intodb(data1=concedes_dict, data2=concede, data3=concedes_dict_rule, cursor=cursor, redis_db=self.redis_db)
+
+        bureaus = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 3, 'p_code': "wq_bureau",
+                   'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        wqone_intodb(data1=bureaus_dict, data2=bureaus, data3=bureaus_dict_rule, cursor=cursor, redis_db=self.redis_db)
+
+        total_number = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 4,
+                        'p_code': "wq_total_number", 'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        wqone_intodb(data1=total_number_dict, data2=total_number, data3=total_number_dict_rule, cursor=cursor, redis_db=self.redis_db)
+
+        odd_evens = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 5, 'p_code': "wq_two_sides",
+                     'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        wqone_intodb(data1=odd_evens_dict, data2=odd_evens, data3=odd_evens_dict_rule, cursor=cursor, redis_db=self.redis_db)
+        match_date, match_time, time3 = new_time(ctime)
+        n_time = out_time(time3, 3)
+        if kemps_dict:
+            for key, value in kemps_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2, pt=pt)
+                    r_hash = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2, pt=pt, odd=value)
+                    odds_only = r_hash
+                    if self.redis_db.hexists("hg3535_wangqiu", r_hash):
+                        pass
+                    else:
+                        self.redis_db.hset("hg3535_wangqiu", r_hash, 0)
+                        if pt == 1:
+                            sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_today, expire_time) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(game_id), utime, utime, value, 2, "wq_kemp", 0, "hg3535", new_hash,
+                                odds_only,1,expire_time, utime, value, odds_only))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(game_id), utime, utime, value, 2, "wq_kemp", 0, "hg3535", odds_only,1))
+                        if pt == 2:
+                            sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_morningplate,expire_time) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(game_id), utime, utime, value, 2, "wq_kemp", 0, "hg3535", new_hash,
+                                odds_only,1,expire_time, utime, value, odds_only))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_morningplate) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(game_id), utime, utime, value, 2, "wq_kemp", 0, "hg3535", odds_only,1))
+                        if pt == 3:
+                            sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_stringscene,expire_time) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(game_id), utime, utime, value, 2, "wq_kemp", 0, "hg3535", new_hash,
+                                odds_only,1,expire_time, utime, value, odds_only))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(game_id), utime, utime, value, 2, "wq_kemp", 0, "hg3535", odds_only,1))
+        us_time = ctime
+        # 插入赛事表
+        if pt == 1:
+            Competition_sql = "insert into st_wq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_today,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+        if pt == 2:
+            Competition_sql = "insert into st_wq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_morningplate,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_morningplate=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+        if pt == 3:
+            Competition_sql = "insert into st_wq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_stringscene,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_stringscene=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+
+    def close_spider(self, spider):
+        self.conn.close()
+        self.dbpool.close()
+
+
+# 网球 波胆--------------------------------------------------------------------------------------------------------------
+class Wqbodanpipeline(object):
+    def __init__(self, dbpool, conn, cursor, redis_db):
+        self.dbpool = dbpool
+        self.conn = conn
+        self.cursor = cursor
+        self.redis_db = redis_db
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            # db = settings["POST_DATABASE"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        conn = psycopg2.connect(host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+        pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"])
+        redis_db = redis.StrictRedis(connection_pool=pool)
+        return cls(dbpool, conn, cursor, redis_db)
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+        # return item
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 比赛日期
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
+        r_ctime = "2019" + "-" + month + "-" + day
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
+        # 比赛id
+        competition_id = item['game_id']
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛name
+        league_name = item['league_name']
+        # 主队
+        team_home = item['team_home']
+        # 客队
+        team_guest = item['team_guest']
+        # 主队得分
+        score_home = item['score_home']
+        # 客队得分
+        score_guest = item['score_guest']
+        # number
+        number = item['number']
+        corner_ball = item['corner_ball']
+        half_way = item['half_way']
+        # 类型早盘,今日,滚球,串场
+        pt = item['pt']
+        bodan_datas = item['bodan_data']
+        p_code = "wq_bodan"
+        p_id = 7
+        bodan_dict = {"wq_bodanhome_two_zero": "2-0", "wq_bodanhome_two_one": "2-1",
+                      "wq_bodanhome_three_zero": "3-0", "wq_bodanhome_three_one": "3-1",
+                      "wq_bodanhome_three_two": "3-2",
+                      "wq_bodanhome_four_zero": "4-0", "wq_bodanhome_four_one": "4-1",
+                      "wq_bodanhome_four_two": "4-2", "wq_bodanhome_four_three": "4-3",
+                      "wq_bodanguest_two_zero": "2-0", "wq_bodanguest_two_one": "2-1",
+                      "wq_bodanguest_three_zero": "3-0",
+                      "wq_bodanguest_three_one": "3-1", "wq_bodanguest_three_two": "3-2",
+                      "wq_bodanguest_four_zero": "4-0", "wq_bodanguest_four_one": "4-1",
+                      "wq_bodanguest_four_two": "4-2", "wq_bodanguest_four_three": "4-3"}
+
+        if bodan_datas:
+            for key, value in bodan_datas.items():
+                if value:
+                    new_hash = hash_func(match_id=competition_id, odds_code=key, sort=0, p_id=7, pt=pt)
+                    r_hash = r_func(match_id=competition_id, odds_code=key, sort=0, p_id=7, pt=pt, odd=value)
+                    odds_only = r_hash
+                    if self.redis_db.hexists("hg3535_wangqiu", r_hash):
+                        pass
+                    else:
+                        self.redis_db.hset("hg3535_wangqiu", r_hash, 0)
+                        if pt == 1:
+                            sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(competition_id), utime, utime, value, p_id, p_code, 0, "hg3535",
+                                new_hash, bodan_dict[key], expire_time, odds_only,1, utime, value, expire_time, odds_only))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(competition_id), utime, utime, value, p_id, p_code, 0, "hg3535", key,
+                                odds_only,1))
+                        if pt == 2:
+                            sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(competition_id), utime, utime, value, p_id, p_code, 0, "hg3535",
+                                new_hash, bodan_dict[key], expire_time, odds_only,1, utime, value, expire_time, odds_only))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(competition_id), utime, utime, value, p_id, p_code, 0, "hg3535", key,
+                                odds_only,1))
+                        if pt == 3:
+                            sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime=%s,odds=%s,expire_time=%s,odds_only=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(competition_id), utime, utime, value, p_id, p_code, 0, "hg3535",
+                                new_hash, bodan_dict[key], expire_time, odds_only,1, utime, value, expire_time, odds_only))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(competition_id), utime, utime, value, p_id, p_code, 0, "hg3535", key,
+                                odds_only,1))
+
+    def close_spider(self, spider):
+        self.conn.close()
+        self.dbpool.close()
+
+
+# 棒球 让球&大小盘--------------------------------------------------------------------------------------------------------
+class Bangqiupipeline(object):
+    def __init__(self, dbpool, conn, cursor, redis_db):
+        self.dbpool = dbpool
+        self.conn = conn
+        self.cursor = cursor
+        self.redis_db = redis_db
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        conn = psycopg2.connect(host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+        pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"])
+        redis_db = redis.StrictRedis(connection_pool=pool)
+        return cls(dbpool, conn, cursor, redis_db)
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+        # return item
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛名
+        league_name = item['league_name']
+        # result = item['result']
+        # 比赛id
+        game_id = item['game_id']
+        # 球队1
+        team_home = item['team_home']
+        # 球队2
+        team_guest = item['team_guest']
+        # 数量(97>)
+        number = item['number']
+        # 比赛状态
+        zhuangtai = item['zhuangtai']
+        # 日期
+        # data_game = item['data_game']
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
+        r_ctime = "2019" + "-" + month + "-" + day
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
+        # 队1分数
+        score_home = item['score_home']
+        # 队2分数
+        score_guest = item['score_guest']
+        # 第几节
+        jijie = item['jijie']
+        # 球队得分
+        qiudui = item['qiudui']
+        pt = item['pt']
+
+        # 让球
+        concedes_dict = item['concedes_dict']
+        concedes_dict_rule = item['concedes_dict_rule']
+        # 独赢
+        capots_dict = item['capots_dict']
+        # 总得分大小
+        total_size_dict = item['total_size_dict']
+        total_size_dict_rule = item['total_size_dict_rule']
+        # 总得分单双
+        odd_evens_dict = item['odd_evens_dict']
+        odd_evens_dict_rule = item['odd_evens_dict_rule']
+
+        # 让球
+        concede = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 1, 'p_code': "bq_concede",
+                   'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        bqone_intodb(data1=concedes_dict, data2=concede, data3=concedes_dict_rule, cursor=cursor, redis_db=self.redis_db)
+        # 总得分:大/小
+        total_size = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 2, 'p_code': "bq_total_size",
+                      'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        bqone_intodb(data1=total_size_dict, data2=total_size, data3=total_size_dict_rule, cursor=cursor, redis_db=self.redis_db)
+
+        odd_even = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 3, 'p_code': "bq_two_sides",
+                    'source': "hg3535", 'expire_time': expire_time, 'sort': 0, 'pt': pt}
+        bqone_intodb(data1=odd_evens_dict, data2=odd_even, data3=odd_evens_dict_rule, cursor=cursor, redis_db=self.redis_db)
+        # 赛事失效时间
+        match_date, match_time, time3 = new_time(ctime)
+        n_time = out_time(time3, 3.5)
+        # 插入独赢
+        if capots_dict:
+            for key, value in capots_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=4, pt=pt)
+                    r_hash = r_func(match_id=game_id, odds_code=key, sort=0, p_id=4, pt=pt, odd=value)
+                    odds_only = r_hash
+                    if self.redis_db.hexists("hg3535_bangqiu", r_hash):
+                        pass
+                    else:
+                        self.redis_db.hset("hg3535_bangqiu", r_hash, 0)
+                        if pt == 1:
+                            sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,expire_time,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s,expire_time=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", new_hash,
+                                odds_only, expire_time,1, utime, value, odds_only, expire_time))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_today) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", odds_only,1))
+                        if pt == 2:
+                            sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,expire_time,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s,expire_time=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", new_hash,
+                                odds_only, expire_time, 1, utime, value, odds_only, expire_time))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_morningplate) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", odds_only,1))
+                        if pt == 3:
+                            sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,expire_time,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s,expire_time=%s;"
+                            cursor.execute(sql1, (
+                                int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", new_hash,
+                                odds_only, expire_time,1, utime, value, odds_only, expire_time))
+                            # 更新主队st_zq_odds_record表
+                            sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_stringscene) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
+                            cursor.execute(sql2, (
+                                int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", odds_only,1))
+        us_time = ctime
+        # 插入赛事表
+        if pt == 1:
+            Competition_sql = "insert into st_bq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_today,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time, 1, us_time, number, n_time, 1))
+        if pt == 2:
+            Competition_sql = "insert into st_bq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_morningplate,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_morningplate=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+        if pt == 3:
+            Competition_sql = "insert into st_bq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,source,expire_time,is_stringscene,us_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_stringscene=%s;"
+            cursor.execute(Competition_sql, (
+                team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, "hg3535",
+                n_time,1, us_time, number, n_time, 1))
+
+
+    def close_spider(self, spider):
+        self.conn.close()
+        self.dbpool.close()
+
+
+# 足球 篮球 网球 棒球 冠军------------------------------------------------------------------------------------------------
+class Guanjunpipeline(object):
+    def __init__(self, dbpool, conn, cursor,redis_db):
+        self.dbpool = dbpool
+        self.conn = conn
+        self.cursor = cursor
+        self.redis_db = redis_db
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        conn = psycopg2.connect(host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+        pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"])
+        redis_db = redis.StrictRedis(connection_pool=pool)
+        return cls(dbpool, conn, cursor, redis_db)
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+        # return item
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 执行具体的插入
+        # 根据不同的item 构建不同的sql语句并插入到mysql中
+        data_game = item['data_game'].replace('年', "-").replace('月', "-").replace('日', "")
+        time_game = item['time_game']
+        ctime = data_game + " " + time_game + ":00"
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
+        league_name = item['league_name']
+        tema_home = item['tema_home']
+        league_id = item['league_id']
+        game_id = item['game_id']
+        new_league_name = item['new_league_name']
+        # 冠军赔率
+        champion_team = item['champion_team']
+        new_champion = item['new_champion']
+        # 构建唯一哈希索引
+        time1 = time.mktime(time.strptime(ctime, '%Y-%m-%d %H:%M:%S')) + 43200
+        time2 = time.localtime(time1)
+        time3 = time.strftime('%Y-%m-%d %H:%M:%S', time2)
+        # data_time = str(time3).split(" ")
+        # match_date,match_time = new_time(ctime)
+        pt = item['pt']
+        new_hash = hash_func(match_id=champion_team, odds_code=new_champion, sort=new_league_name, p_id=tema_home,
+                             pt=pt)
+
+        ball = item['ball']
+        # 插入st_zq_odds表
+        r_hash = hash_func(league_id, new_champion, tema_home, champion_team, pt)
+        odds_only = r_hash
+        s_hash = hash_func(league_id, league_name, ball, 0, 0)
+        if ball == "足球":
+            n_gameid = int('1' + str(league_id))
+            data_dict = {'league_id': league_id, 'new_champion': new_champion, 'utime': utime,
+                         'champion_team': champion_team, "p_id": 8, 'new_league_name': new_league_name,
+                         'tema_home': tema_home, 'new_hash': new_hash, 'expire_time': expire_time,
+                         "odds_only": odds_only,
+                         "league_name": league_name, 'time3': time3, 'game_id': n_gameid}
+            gjz_into(data_dict, cursor, r_hash, s_hash, self.redis_db, pt)
+            Competition_sql = "insert into st_zq_competition(home_team, lg_id, match_id, ctime, utime, source, us_time) values (%s, %s, %s, %s, %s, %s, %s) on conflict(match_id) do update set utime=%s;"
+            cursor.execute(Competition_sql, (league_name, league_id, n_gameid, utime, utime, 'hg3535', data_game, utime))
+
+        if ball == "篮球":
+            n_gameid = int('2' + str(league_id))
+            data_dict = {'league_id': league_id, 'new_champion': new_champion, 'utime': utime,
+                         'champion_team': champion_team, "p_id": 7, 'new_league_name': new_league_name,
+                         'tema_home': tema_home, 'new_hash': new_hash, 'expire_time': expire_time,
+                         "odds_only": odds_only,
+                         "league_name": league_name, 'time3': time3, 'game_id': n_gameid}
+            gjl_into(data_dict, cursor, r_hash, s_hash, self.redis_db, pt)
+            Competition_sql = "insert into st_lq_competition(home_team, lg_id, match_id, ctime, utime, source, us_time) values (%s, %s, %s, %s, %s, %s, %s) on conflict(match_id) do update set utime=%s;"
+            cursor.execute(Competition_sql, (league_name, league_id, n_gameid, utime, utime, 'hg3535', data_game, utime))
+
+        if ball == "网球":
+            n_gameid = int('3' + str(league_id))
+            data_dict = {'league_id': league_id, 'new_champion': new_champion, 'utime': utime,
+                         'champion_team': champion_team, "p_id": 6, 'new_league_name': new_league_name,
+                         'tema_home': tema_home, 'new_hash': new_hash, 'expire_time': expire_time,
+                         "odds_only": odds_only,
+                         "league_name": league_name, 'time3': time3, 'game_id': n_gameid}
+            gjw_into(data_dict, cursor, r_hash, s_hash, self.redis_db, pt)
+            Competition_sql = "insert into st_wq_competition(home_team, lg_id, match_id, ctime, utime, source, us_time) values (%s, %s, %s, %s, %s, %s, %s) on conflict(match_id) do update set utime=%s;"
+            cursor.execute(Competition_sql, (league_name, league_id, n_gameid, utime, utime, 'hg3535', data_game, utime))
+
+        if ball == "棒球":
+            n_gameid = int('4' + str(league_id))
+            data_dict = {'league_id': league_id, 'new_champion': new_champion, 'utime': utime,
+                         'champion_team': champion_team, "p_id": 5, 'new_league_name': new_league_name,
+                         'tema_home': tema_home, 'new_hash': new_hash, 'expire_time': expire_time,
+                         "odds_only": odds_only,
+                         "league_name": league_name, 'time3': time3, 'game_id': n_gameid}
+            gjb_into(data_dict, cursor, r_hash, s_hash, self.redis_db, pt)
+            Competition_sql = "insert into st_bq_competition(home_team, lg_id, match_id, ctime, utime, source, us_time) values (%s, %s, %s, %s, %s, %s, %s) on conflict(match_id) do update set utime=%s;"
+            cursor.execute(Competition_sql, (league_name, league_id, n_gameid, utime, utime, 'hg3535', data_game, utime))
+
+    def close_spider(self, spider):
+        self.conn.close()
+        self.dbpool.close()
+
+
+# 足球 篮球 网球 棒球 联赛------------------------------------------------------------------------------------------------
+class Liansaipipeline(object):
+    def __init__(self, dbpool, conn, cursor, redis_db):
+        self.dbpool = dbpool
+        self.conn = conn
+        self.cursor = cursor
+        self.redis_db = redis_db
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        conn = psycopg2.connect(host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+        pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"])
+        redis_db = redis.StrictRedis(connection_pool=pool)
+        return cls(dbpool, conn, cursor, redis_db)
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+        # return item
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        area_id = item["area_id"]
+        area_name = item["area_name"]
+        st_league = item["st_league"]
+        name_chinese = item["name_chinese"]
+        ball = item['ball']
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        area_dict = {"南美洲": 3, "北美洲": 4, "欧洲": 5, "大洋洲": 6, "南极洲": 7, "非洲": 1, "世界": 8, "亚洲": 2}
+        redis_data_dict = "hg3535_liansai"
+        r_hash = hash_func(st_league, name_chinese, ball, 0, 0)
+        if self.redis_db.hexists(redis_data_dict, r_hash):
+            pass
+        else:
+            self.redis_db.hset(redis_data_dict, r_hash, 0)
+            if ball == "足球":
+                if area_name in area_dict:
+                    sql1 = "insert into st_zq_league(name_chinese, lg_id, area_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set area_id = %s,source=%s;"
+                    cursor.execute(sql1, (name_chinese, st_league, area_dict[area_name], "hg3535",utime, area_dict[area_name], "hg3535"))
+                else:
+                    if area_name == "足球":
+                        sql2 = "insert into st_zq_league(name_chinese, lg_id, country_id,source) values (%s, %s, %s,%s) on conflict(lg_id) do update set source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, 0, "hg3535", "hg3535"))
+                    else:
+                        sql2 = "insert into st_zq_league(name_chinese, lg_id, country_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set country_id = %s,source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, area_id, "hg3535",utime, area_id, "hg3535"))
+
+                        sql3 = "insert into st_country(country_id, name_chinese, country_area, country_order,recommend_order, update_time,source) values (%s, %s, %s,%s, %s, %s,%s) on conflict(country_id) do update set update_time =%s,source=%s;"
+                        cursor.execute(sql3, (area_id, area_name, 0, 0, 0, utime, "hg3535", utime, "hg3535"))
+            elif ball == "篮球":
+                if area_name in area_dict:
+                    sql1 = "insert into st_lq_league(name_chinese, lg_id, area_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set area_id = %s,source=%s;"
+                    cursor.execute(sql1,
+                                   (name_chinese, st_league, area_dict[area_name], "hg3535",utime, area_dict[area_name],"hg3535"))
+                else:
+                    if area_name == "篮球":
+                        sql2 = "insert into st_lq_league(name_chinese, lg_id, country_id,source) values (%s, %s, %s,%s) on conflict(lg_id) do update set source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, 0, "hg3535", "hg3535"))
+                    else:
+                        sql2 = "insert into st_lq_league(name_chinese, lg_id, country_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set country_id = %s,source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, area_id, "hg3535",utime, area_id, "hg3535"))
+
+                        sql3 = "insert into st_country(country_id, name_chinese, country_area, country_order,recommend_order, update_time,source) values (%s, %s, %s,%s, %s, %s,%s) on conflict(country_id) do update set update_time =%s,source=%s;"
+                        cursor.execute(sql3, (area_id, area_name, 0, 0, 0, utime, "hg3535", utime, "hg3535"))
+            elif ball == "网球":
+                if area_name in area_dict:
+                    sql1 = "insert into st_wq_league(name_chinese, lg_id, area_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set area_id = %s,source=%s;"
+                    cursor.execute(sql1, (name_chinese, st_league, area_dict[area_name], "hg3535",utime, area_dict[area_name],"hg3535"))
+                else:
+                    if area_name == "网球":
+                        sql2 = "insert into st_wq_league(name_chinese, lg_id, country_id,source) values (%s, %s, %s,%s) on conflict(lg_id) do update set source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, 0, "hg3535", "hg3535"))
+                    else:
+                        sql2 = "insert into st_wq_league(name_chinese, lg_id, country_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set country_id = %s,source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, area_id, "hg3535",utime, area_id, "hg3535"))
+
+                        sql3 = "insert into st_country(country_id, name_chinese, country_area, country_order,recommend_order, update_time,source) values (%s, %s, %s,%s, %s, %s,%s) on conflict(country_id) do update set update_time =%s,source=%s;"
+                        cursor.execute(sql3, (area_id, area_name, 0, 0, 0, utime, "hg3535", utime, "hg3535"))
+            elif ball == "棒球":
+                if area_name in area_dict:
+                    sql1 = "insert into st_bq_league(name_chinese, lg_id, area_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set area_id = %s,source=%s;"
+                    cursor.execute(sql1,(name_chinese, st_league, area_dict[area_name], "hg3535",utime, area_dict[area_name],"hg3535"))
+                else:
+                    if area_name == "棒球":
+                        sql2 = "insert into st_bq_league(name_chinese, lg_id, country_id,source) values (%s, %s, %s,%s) on conflict(lg_id) do update set source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, 0, "hg3535", "hg3535"))
+                    else:
+                        sql2 = "insert into st_bq_league(name_chinese, lg_id, country_id,source,utime) values (%s, %s, %s,%s,%s) on conflict(lg_id) do update set country_id = %s,source=%s;"
+                        cursor.execute(sql2, (name_chinese, st_league, area_id, "hg3535",utime, area_id, "hg3535"))
+
+                        sql3 = "insert into st_country(country_id, name_chinese, country_area, country_order,recommend_order, update_time,source) values (%s, %s, %s,%s, %s, %s,%s) on conflict(country_id) do update set update_time =%s,source=%s;"
+                        cursor.execute(sql3, (area_id, area_name, 0, 0, 0, utime, "hg3535", utime, "hg3535"))
+
+    def close_spider(self, spider):
+        self.conn.close()
+        self.dbpool.close()
+        # self.redis_db.disconnect()
+

+ 71 - 0
new_hg3535s/hg3535/requirements.txt

@@ -0,0 +1,71 @@
+aiopg==0.16.0
+asn1crypto==0.24.0
+asyncio==3.4.3
+attrs==19.1.0
+Automat==0.7.0
+bsddb3==6.2.6
+certifi==2019.3.9
+cffi==1.12.2
+chardet==3.0.4
+Click==7.0
+constantly==15.1.0
+cryptography==2.6.1
+cssselect==1.0.3
+defusedxml==0.5.0
+et-xmlfile==1.0.1
+Flask==1.0.2
+Flask-Login==0.4.1
+hyperlink==18.0.0
+idna==2.8
+incremental==17.5.0
+inotify==0.2.10
+itsdangerous==1.1.0
+jdcal==1.4
+Jinja2==2.10
+jmespath==0.9.4
+jsmin==2.2.2
+lxml==4.3.2
+MarkupSafe==1.1.1
+nose==1.3.7
+openpyxl==2.6.1
+parsel==1.5.1
+peewee==2.8.0
+psycopg2==2.7.7
+psycopg2-binary==2.8
+pyasn1==0.4.5
+pyasn1-modules==0.2.4
+pycparser==2.19
+pycurl==7.43.0.2
+PyDispatcher==2.0.5
+PyHamcrest==1.9.0
+PyMySQL==0.9.3
+pyOpenSSL==19.0.0
+pypiwin32==223
+pyquery==1.4.0
+pyspider==0.3.10
+python-dateutil==2.8.0
+pytz==2018.9
+pywin32==224
+PyYAML==3.13
+queuelib==1.5.0
+redis==3.2.1
+requests==2.21.0
+Scrapy==1.6.0
+scrapy-deltafetch==1.2.1
+scrapy-magicfields==1.1.0
+scrapy-redis==0.6.8
+scrapy-splash==0.7.2
+scrapyd==1.2.0
+scrapyd-client==1.1.0
+selenium==3.141.0
+service-identity==18.1.0
+six==1.12.0
+tblib==1.3.2
+tornado==4.5.3
+Twisted==18.9.0
+u-msgpack-python==2.5.1
+urllib3==1.24.1
+w3lib==1.20.0
+Werkzeug==0.14.1
+WsgiDAV==2.4.1
+zope.interface==4.6.0

+ 0 - 0
new_hg3535s/hg3535/scrapy-magicfields)


+ 126 - 0
new_hg3535s/hg3535/settings.py

@@ -0,0 +1,126 @@
+# -*- coding: utf-8 -*-
+
+# Scrapy settings for hg3535 project
+#
+# For simplicity, this file contains only settings considered important or
+# commonly used. You can find more settings consulting the documentation:
+#
+#     https://doc.scrapy.org/en/latest/topics/settings.html
+#     https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
+#     https://doc.scrapy.org/en/latest/topics/spider-middleware.html
+
+BOT_NAME = 'hg3535'
+
+SPIDER_MODULES = ['hg3535.spiders']
+NEWSPIDER_MODULE = 'hg3535.spiders'
+
+
+# Crawl responsibly by identifying yourself (and your website) on the user-agent
+USER_AGENT = {
+    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20120813 Firefox/16.0'
+}
+
+# Obey robots.txt rules
+ROBOTSTXT_OBEY = False
+
+# Configure maximum concurrent requests performed by Scrapy (default: 16)
+CONCURRENT_REQUESTS = 64
+
+# Configure a delay for requests for the same website (default: 0)
+# See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay
+# See also autothrottle settings and docs
+#DOWNLOAD_DELAY = 3
+DOWNLOAD_DELAY = 0
+# The download delay setting will honor only one of:
+CONCURRENT_REQUESTS_PER_DOMAIN = 32
+CONCURRENT_REQUESTS_PER_IP = 0
+
+# Disable cookies (enabled by default)
+#COOKIES_ENABLED = False
+
+# Disable Telnet Console (enabled by default)
+#TELNETCONSOLE_ENABLED = False
+
+# Override the default request headers:
+#DEFAULT_REQUEST_HEADERS = {
+#   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+#   'Accept-Language': 'en',
+#}
+
+# Enable or disable spider middlewares
+# See https://doc.scrapy.org/en/latest/topics/spider-middleware.html
+# from scrapy_deltafetch
+# SPIDER_MIDDLEWARES = {
+#    # 'scrapy_deltafetch.DeltaFetch': 100,
+#    'hg3535.middlewares.Hg3535SpiderMiddleware': 543
+# }
+# #
+# DELTAFETCH_ENABLED = True
+
+
+# Enable or disable downloader middlewares
+# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
+# DOWNLOADER_MIDDLEWARES = {
+#    'hg3535.middlewares.Hg3535DownloaderMiddleware': 543,
+# }
+
+# Enable or disable extensions
+# See https://doc.scrapy.org/en/latest/topics/extensions.html
+#EXTENSIONS = {
+#    'scrapy.extensions.telnet.TelnetConsole': None,
+#}
+
+# Configure item pipelines
+# See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
+ITEM_PIPELINES = {
+   # 篮球
+   'hg3535.pipelines.Lanqiupipeline': 300,
+   # 冠军
+   'hg3535.pipelines.Guanjunpipeline': 300,
+   # 联赛
+   'hg3535.pipelines.Liansaipipeline': 300,
+   # 足球
+   'hg3535.pipelines.Zuqiupipeline': 300,
+   # 网球
+   "hg3535.pipelines.Wangqiupipeline": 300,
+   # 网球波胆
+   'hg3535.pipelines.Wqbodanpipeline': 300,
+   # 棒球让球&大小盘
+   "hg3535.pipelines.Bangqiupipeline": 300,
+}
+
+# Enable and configure the AutoThrottle extension (disabled by default)
+# See https://doc.scrapy.org/en/latest/topics/autothrottle.html
+#AUTOTHROTTLE_ENABLED = True
+# The initial download delay
+#AUTOTHROTTLE_START_DELAY = 5
+# The maximum download delay to be set in case of high latencies
+#AUTOTHROTTLE_MAX_DELAY = 60
+# The average number of requests Scrapy should be sending in parallel to
+# each remote server
+#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
+# Enable showing throttling stats for every response received:
+#AUTOTHROTTLE_DEBUG = False
+
+# Enable and configure HTTP caching (disabled by default)
+# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
+#HTTPCACHE_ENABLED = True
+#HTTPCACHE_EXPIRATION_SECS = 0
+#HTTPCACHE_DIR = 'httpcache'
+#HTTPCACHE_IGNORE_HTTP_CODES = []
+#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
+
+# POST_HOST = 'localhost'
+# POST_DATABASE = 'postgres'
+# POST_USER = 'postgres'
+# POST_PORT = '5433'
+# POST_PASSWORD = '123456'
+
+R_HOST = 'localhost'
+R_POST = '6379'
+
+POST_HOST = '192.168.2.200'
+POST_DATABASE = 'kaiyou'
+POST_USER = 'kaiyou'
+POST_PORT = '10432'
+POST_PASSWORD = '123456'

+ 4 - 0
new_hg3535s/hg3535/spiders/__init__.py

@@ -0,0 +1,4 @@
+# This package will contain the spiders of your Scrapy project
+#
+# Please refer to the documentation for information on how to create and manage
+# your spiders.

二進制
new_hg3535s/hg3535/spiders/__pycache__/__init__.cpython-36.pyc


二進制
new_hg3535s/hg3535/spiders/__pycache__/bangqiu.cpython-36.pyc


二進制
new_hg3535s/hg3535/spiders/__pycache__/guanjun.cpython-36.pyc


二進制
new_hg3535s/hg3535/spiders/__pycache__/lanqiu.cpython-36.pyc


二進制
new_hg3535s/hg3535/spiders/__pycache__/liansai.cpython-36.pyc


二進制
new_hg3535s/hg3535/spiders/__pycache__/wangqiu.cpython-36.pyc


二進制
new_hg3535s/hg3535/spiders/__pycache__/wgbodan.cpython-36.pyc


二進制
new_hg3535s/hg3535/spiders/__pycache__/zuqiu.cpython-36.pyc


+ 245 - 0
new_hg3535s/hg3535/spiders/bangqiu.py

@@ -0,0 +1,245 @@
+# -*- coding: utf-8 -*-
+import copy
+import json
+
+import scrapy
+from scrapy.http import Request
+
+from ..items import Bangqiu
+
+
+class BqrangqiuSpider(scrapy.Spider):
+    name = 'bangqiu'
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            "hg3535.pipelines.Bangqiupipeline": 300,
+        }
+    }
+    def start_requests(self):
+        for y in range(1, 4):
+            url = 'http://hg3535z.com/odds2/d/getodds?sid=4&pt=' + str(y) + '&ubt=am&pn=0&sb=2&dc=null&pid=0'
+            yield scrapy.Request(url=url, callback=self.parse, meta={'pt': y, 'dont_redirect': True})
+
+    def parse(self, response):
+        if response.text:
+            try:
+                datas = json.loads(response.text).get('n-ot', "").get('egs', "")
+            except:
+                datas = ""
+            try:
+                pt = copy.copy(response.meta['pt'])
+            except:
+                pt = 0
+            if datas:
+                for result in datas:
+                    new_results = result['es']
+                    for new_result in new_results:
+                        game_id = str(new_result['i'][16])
+                        if pt == 1:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=false"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 2:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=false"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 3:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=true"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+
+    def parse_each(self, response):
+        try:
+            new_datas = json.loads(response.text)['eg']
+        except:
+            new_datas = ""
+        try:
+            pt = response.meta['pt']
+        except:
+            pt = 0
+        if new_datas:
+            # 联赛id
+            league_id = new_datas["c"]["k"]
+            # 联赛名
+            league_name = new_datas["c"]["n"]
+            new_data = new_datas["es"]
+            for result in new_data:
+                if result['pci']["ctid"] == 0:
+                    item = Bangqiu()
+                    # 比赛id
+                    game_id = str(result['k'])
+                    # 球队1
+                    team_home = result['i'][0]
+                    # 球队2
+                    team_guest = result['i'][1]
+                    # 数量(97>)
+                    number = result['i'][2]
+                    # 比赛状态
+                    zhuangtai = result['i'][3]
+                    # 日期
+                    data_game = result['i'][4]
+                    # 开赛时间
+                    time_game = result['i'][5]
+                    # 队1分数
+                    score_home1 = result['i'][10]
+                    # 队2分数
+                    score_guest1 = result['i'][11]
+                    # 第几盘
+                    jijie = result['i'][12]
+                    # 球队得分
+                    qiudui = result['pci'].get('ctn', "")
+# --------------------------------------------------让球分割线-----------------------------------------------------------
+                    concedes_dict = {}
+                    concedes_dict_rule = {}
+                    try:
+                        concedes = result['o']["ah"]["v"]
+                        # concedes_dict_rule['bq_concede_home'] = concedes[1]
+                        home_rule = concedes[1]
+                        if home_rule.startswith('+'):
+                            n_home_rule = home_rule.replace('+', '-')
+                            concedes_dict_rule['bq_concede_home'] = n_home_rule
+                        if home_rule.startswith('-'):
+                            n_home_rule = home_rule.replace('-', '+')
+                            concedes_dict_rule['bq_concede_home'] = n_home_rule
+                        else:
+                            concedes_dict_rule['bq_concede_home'] = home_rule
+                        concedes_dict['bq_concede_home'] = concedes[5]
+                        # concedes_dict_rule['bq_concede_guest'] = concedes[3]
+                        guest_rule = concedes[3]
+                        if guest_rule.startswith('+'):
+                            n_guest_rule = home_rule.replace('+', '-')
+                            concedes_dict_rule['bq_concede_guest'] = n_guest_rule
+                        if guest_rule.startswith('-'):
+                            n_guest_rule = home_rule.replace('-', '+')
+                            concedes_dict_rule['bq_concede_guest'] = n_guest_rule
+                        else:
+                            concedes_dict_rule['bq_concede_guest'] = guest_rule
+                        concedes_dict['bq_concede_guest'] = concedes[7]
+                    except:
+                        concedes_dict_rule['bq_concede_home'] = ""
+                        concedes_dict['bq_concede_home'] = ""
+                        concedes_dict_rule['bq_concede_guest'] = ""
+                        concedes_dict['bq_concede_guest'] = ""
+# 让球 前5局-------------------------------------------------------------------------------------------------------------
+                    try:
+                        concedes = result['o']["ahf5in"]["v"]
+                        # concedes_dict_rule['bq_five_concede_home'] = concedes[1]
+                        home_rule = concedes[1]
+                        if home_rule.startswith('+'):
+                            n_home_rule = home_rule.replace('+', '-')
+                            concedes_dict_rule['bq_five_concede_home'] = n_home_rule
+                        if home_rule.startswith('-'):
+                            n_home_rule = home_rule.replace('-', '+')
+                            concedes_dict_rule['bq_five_concede_home'] = n_home_rule
+                        else:
+                            concedes_dict_rule['bq_five_concede_home'] = home_rule
+                        concedes_dict['bq_five_concede_home'] = concedes[5]
+                        # concedes_dict_rule['bq_five_concede_guest'] = concedes[3]
+                        guest_rule = concedes[3]
+                        if guest_rule.startswith('+'):
+                            n_guest_rule = home_rule.replace('+', '-')
+                            concedes_dict_rule['bq_five_concede_guest'] = n_guest_rule
+                        if guest_rule.startswith('-'):
+                            n_guest_rule = home_rule.replace('-', '+')
+                            concedes_dict_rule['bq_five_concede_guest'] = n_guest_rule
+                        else:
+                            concedes_dict_rule['bq_five_concede_guest'] = guest_rule
+                        concedes_dict['bq_five_concede_guest'] = concedes[7]
+                    except:
+                        concedes_dict_rule['bq_five_concede_home'] = ""
+                        concedes_dict['bq_five_concede_home'] = ""
+                        concedes_dict_rule['bq_five_concede_guest'] = ""
+                        concedes_dict['bq_five_concede_guest'] = ""
+# ---------------------------------------------------独赢----------------------------------------------------------------
+                    capots_dict = {}
+                    try:
+                        capots = result['o']["ml"]["v"]
+                        capots_dict['bq_capot_home'] = capots[1]
+                        capots_dict['bq_capot_guest'] = capots[3]
+
+                    except:
+                        capots_dict['bq_capot_home'] = ""
+                        capots_dict['bq_capot_guest'] = ""
+# ---------------------------------------------------总得分:大/小--------------------------------------------------------
+
+                    total_size_dict = {}
+                    total_size_dict_rule = {}
+                    try:
+                        total_sizes = result['o']["ou"]["v"]
+                        total_size_dict_rule['bq_total_number_big'] = total_sizes[1]
+                        total_size_dict['bq_total_number_big'] = total_sizes[5]
+                        total_size_dict_rule['bq_total_number_small'] = total_sizes[3]
+                        total_size_dict['bq_total_number_small'] = total_sizes[7]
+                    except:
+                        total_size_dict_rule['bq_total_number_big'] = ""
+                        total_size_dict['bq_total_number_big'] = ""
+                        total_size_dict_rule['bq_total_number_small'] = ""
+                        total_size_dict['bq_total_number_small'] = ""
+# 总得分: 大/小 前5局-----------------------------------------------------------------------------------------------------
+                    try:
+                        total_sizes = result['o']["ouf5in"]["v"]
+                        total_size_dict_rule['bq_five_total_number_big'] = total_sizes[1]
+                        total_size_dict['bq_five_total_number_big'] = total_sizes[5]
+                        total_size_dict_rule['bq_five_total_number_small'] = total_sizes[3]
+                        total_size_dict['bq_five_total_number_small'] = total_sizes[7]
+                    except:
+                        total_size_dict_rule['bq_five_total_number_big'] = ""
+                        total_size_dict['bq_five_total_number_big'] = ""
+                        total_size_dict_rule['bq_five_total_number_small'] = ""
+                        total_size_dict['bq_five_total_number_small'] = ""
+
+# ------------------------------------------------------总得分:单/双-----------------------------------------------------
+                    odd_evens_dict = {}
+                    odd_evens_dict_rule = {}
+                    try:
+                        odd_evens = result['o']["oe"]["v"]
+                        # 上半场 主队让球条件
+                        odd_evens_dict['bq_two_sides_single'] = odd_evens[1]
+                        odd_evens_dict_rule['bq_two_sides_single'] = "单"
+                        odd_evens_dict['bq_two_sides_double'] = odd_evens[3]
+                        odd_evens_dict_rule['bq_two_sides_double'] = "双"
+
+                    except:
+                        odd_evens_dict['bq_two_sides_single'] = ""
+                        odd_evens_dict['bq_two_sides_single'] = ""
+                        odd_evens_dict_rule['bq_two_sides_double'] = ""
+                        odd_evens_dict_rule['bq_two_sides_double'] = ""
+
+                    # 联赛id
+                    item['league_id'] = league_id
+                    # 联赛名
+                    item['league_name'] = league_name
+                    # 比赛id
+                    item['game_id'] = game_id
+                    # 球队1
+                    item['team_home'] = team_home
+                    # 球队2
+                    item['team_guest'] = team_guest
+                    # 数量(97>)
+                    item['number'] = number
+                    # 比赛状态
+                    item['zhuangtai'] = zhuangtai
+                    # 日期
+                    item['data_game'] = data_game
+                    # 开赛时间
+                    item['time_game'] = time_game
+                    # 队1分数
+                    item['score_home'] = score_home1
+                    # 队2分数
+                    item['score_guest'] = score_guest1
+                    # 第几节
+                    item['jijie'] = jijie
+                    item['pt'] = pt
+                    # 球队得分
+                    item['qiudui'] = qiudui
+                    # 让球
+                    item['concedes_dict'] = concedes_dict
+                    item['concedes_dict_rule'] = concedes_dict_rule
+                    # 独赢
+                    item['capots_dict'] = capots_dict
+                    # 总得分:大/小
+                    item['total_size_dict'] = total_size_dict
+                    item['total_size_dict_rule'] = total_size_dict_rule
+                    # 总得分:单/双
+                    item['odd_evens_dict'] = odd_evens_dict
+                    item['odd_evens_dict_rule'] = odd_evens_dict_rule
+                    yield item
+

+ 76 - 0
new_hg3535s/hg3535/spiders/guanjun.py

@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+import copy
+import json
+
+import scrapy
+from scrapy.http import Request
+
+from .. items import Guanjun
+
+
+class LqguanjunSpider(scrapy.Spider):
+    name = 'guanjun'
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            'hg3535.pipelines.Guanjunpipeline': 300,
+        }
+    }
+
+    def start_requests(self):
+        for z in range(1, 5):
+            for y in range(1, 4):
+                for x in range(0, 4):
+                    url = 'http://hg3535z.com/odds2/d/getodds?sid=' + str(z) + '&pt=' + str(y) + '&ubt=or&pn=' + str(
+                        x) + '&sb=2&dc=null&pid=0'
+                    yield Request(url=url, callback=self.parse, meta={'pt': y, 'sid': z, 'url': url})
+
+    def parse(self, response):
+        try:
+            datas = json.loads(response.text)
+        except:
+            datas = ""
+        try:
+            results = datas['n-ot']['egs']
+        except:
+            results = ""
+        try:
+            pt = copy.copy(response.meta['pt'])
+        except:
+            pt = 0
+        try:
+            ball = datas['n-ot']['s']['n']
+        except:
+            ball = ""
+        if results:
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+
+                    data_game = new_result['i'][4]
+                    time_game = new_result['i'][5]
+                    new_league_name = new_result['egn'].replace('\t', '')
+
+                    for i in new_result['n-o']:
+                        new_champion = i['mn']
+                        for y in i['o']:
+                            item = Guanjun()
+                            game_id = str(new_result['i'][16])
+                            tema_home = y[0]
+                            champion_team = float(y[2]) - 1
+                            item['league_name'] = league_name
+                            item['tema_home'] = tema_home
+                            item['league_id'] = league_id
+                            item['game_id'] = game_id
+                            item['data_game'] = data_game
+                            item['time_game'] = time_game
+                            item['new_league_name'] = new_league_name
+                            item['champion_team'] = champion_team
+                            item['new_champion'] = new_champion
+                            item['pt'] = pt
+                            item['ball'] = ball
+                            yield item

+ 851 - 0
new_hg3535s/hg3535/spiders/lanqiu.py

@@ -0,0 +1,851 @@
+# -*- coding: utf-8 -*-
+import copy
+import json
+
+import scrapy
+from scrapy.http import Request
+
+from .. items import Lanqiu
+
+
+def rangqiu_daxiao(inner):
+    concede = [inner[i] for i in range(len(inner)) if i % 2 == 1]
+    # 主队让球条件赔率
+    concedehome = [concede[i] for i in range(len(concede)) if i % 2 == 0]
+    # 客队让球条件赔率
+    concedeguest = [concede[i] for i in range(len(concede)) if i % 2 == 1]
+    # 主队让球条件
+    # concede_home_rule = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 0]
+    concede_home_rule = []
+    for i in range(len(concedehome)):
+        if i % 2 == 0:
+            home_rule = concedehome[i]
+            if home_rule.startswith('+'):
+                n_home_rule = home_rule.replace('+', '-')
+                concede_home_rule.append(n_home_rule)
+            if home_rule.startswith('-'):
+                n_home_rule = home_rule.replace('-', '+')
+                concede_home_rule.append(n_home_rule)
+            else:
+                concede_home_rule.append(home_rule)
+    # 主队让球赔率
+    concede_home = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 1]
+    # 客队让球条件
+    # concede_guest_rule = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 0]
+    concede_guest_rule = []
+    for i in range(len(concedeguest)):
+        if i % 2 == 0:
+            guest_rule = concedeguest[i]
+            if guest_rule.startswith('+'):
+                n_guest_rule = guest_rule.replace('+', '-')
+                concede_guest_rule.append(n_guest_rule)
+            if guest_rule.startswith('-'):
+                n_guest_rule = guest_rule.replace('-', '+')
+                concede_guest_rule.append(n_guest_rule)
+            else:
+                concede_guest_rule.append(guest_rule)
+    # 客队让球赔率
+    concede_guest = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 1]
+    return concede_home_rule, concede_home, concede_guest_rule, concede_guest
+
+
+def danshaung_fun(inner):
+    odd_even = [inner[i] for i in range(len(inner)) if i % 2 == 1]
+    # 全场 总分单
+    odd_even_odd = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 0]
+    # 全场 总分双
+    odd_even_even = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 1]
+    return odd_even_odd, odd_even_even
+
+
+class LanqiuSpider(scrapy.Spider):
+
+    name = "lanqiu"
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            "hg3535.pipelines.Lanqiupipeline": 300,
+        }
+    }
+
+    def start_requests(self):
+        # newall_lists = ['am', 'ftht1x2', 'oe', 'tg', 'htft', 'cs', 'fglg', 'or']
+        for y in range(1, 4):
+            url = 'http://hg3535z.com/odds2/d/getodds?sid=2&pt='+str(y)+'&ubt=am&pn=0&sb=2&dc=null&pid=0'
+            yield scrapy.Request(url=url, callback=self.parse, meta={'pt': y,'dont_redirect': True})
+
+    def parse(self, response):
+        if response.text:
+            try:
+                datas = json.loads(response.text).get('n-ot', "").get('egs', "")
+            except:
+                datas = ""
+            try:
+                pt = copy.copy(response.meta['pt'])
+            except:
+                pt = 0
+            if datas:
+                # id_list = []
+                for result in datas:
+                    new_results = result['es']
+                    for new_result in new_results:
+                        game_id = str(new_result['i'][16])
+                        if pt == 1:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=false"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 2:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=false"
+                            # http://hg3535z.com/odds2/d/getamodds?eid=3136803&iip=false&ubt=am&isp=false
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 3:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=true"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+    def parse_each(self, response):
+        new_datas = json.loads(response.text).get('eg', "")
+        try:
+            pt = response.meta['pt']
+        except:
+            pt = 0
+        item = Lanqiu()
+        if new_datas:
+            # 联赛id
+            league_id = new_datas.get("c", "").get("k", "")
+            # 联赛名
+            league_name = new_datas.get("c", "").get("n", "")
+            new_data = new_datas.get("es", "")
+            result = new_data[0]
+            # 比赛id
+            game_id = str(result['k'])
+            # 球队1
+            team_home = result['i'][0]
+            # 球队2
+            team_guest = result['i'][1]
+            # 数量(97>)
+            number = result['i'][2]
+            # 比赛状态
+            zhuangtai = result['i'][3]
+            # 日期
+            data_game = result['i'][4]
+            # 开赛时间
+            time_game = result['i'][5]
+            # 队1分数
+            score_home1 = result['i'][10]
+            # 队2分数
+            score_guest1 = result['i'][11]
+            # 第几节
+            jijie = result['i'][12]
+            # 球队得分
+            qiudui = result['pci'].get('ctn', "")
+# ----------------------------------------让球分割线---------------------------------------------------------------------------
+            concedes_dict = {}
+            concedes_dict_rule = {}
+            try:
+                concedes = result['o']["ah"]["v"]
+                # print(concedes)
+                # 主队让球条件,主队让球赔率,客队让球条件,客队让球赔率
+                concede_home_rule,concede_home,concede_guest_rule,concede_guest=rangqiu_daxiao(inner=concedes)
+                concedes_dict_rule['lq_concede_home'] = concede_home_rule
+                concedes_dict['lq_concede_home'] = concede_home
+                concedes_dict_rule['lq_concede_guest'] = concede_guest_rule
+                concedes_dict['lq_concede_guest'] = concede_guest
+            except:
+                concede_guest = ""
+                concede_guest_rule = ""
+                concede_home = ""
+                concede_home_rule = ""
+                concedes_dict_rule['lq_concede_home'] = concede_home_rule
+                concedes_dict['lq_concede_home'] = concede_home
+                concedes_dict_rule['lq_concede_guest'] = concede_guest_rule
+                concedes_dict['lq_concede_guest'] = concede_guest
+            # print(concedes_dict)
+            try:
+                half_concedes = result['o']["ah1st"]["v"]
+                # 上半场 主队让球条件
+                half_concede_home_rule, half_concede_home, half_concede_guest_rule, half_concede_guest=rangqiu_daxiao(inner=half_concedes)
+                concedes_dict_rule['lq_half_concede_home'] = half_concede_home_rule
+                concedes_dict['lq_half_concede_home'] = half_concede_home
+                concedes_dict_rule['lq_half_concede_guest'] = half_concede_guest_rule
+                concedes_dict['lq_half_concede_guest'] = half_concede_guest
+
+            except:
+                half_concede_home_rule = ""
+                half_concede_home = ""
+                half_concede_guest_rule = ""
+                half_concede_guest = ""
+                concedes_dict_rule['lq_half_concede_home'] = half_concede_home_rule
+                concedes_dict['lq_half_concede_home'] = half_concede_home
+                concedes_dict_rule['lq_half_concede_guest'] = half_concede_guest_rule
+                concedes_dict['lq_half_concede_guest'] = half_concede_guest
+
+            # 第一节让球
+            try:
+                one_concedes = result['o']["ahq1"]["v"]
+                one_concede_home_rule,one_concede_home,one_concede_guest_rule,one_concede_guest = rangqiu_daxiao(inner=one_concedes)
+                concedes_dict_rule['lq_one_concede_home'] = one_concede_home_rule
+                concedes_dict['lq_one_concede_home'] = one_concede_home
+                concedes_dict_rule['lq_one_concede_guest'] = one_concede_guest_rule
+                concedes_dict['lq_one_concede_guest'] = one_concede_guest
+
+            except:
+                one_concede_guest = ""
+                one_concede_guest_rule = ""
+                one_concede_home = ""
+                one_concede_home_rule = ""
+                concedes_dict['lq_one_concede_home_rule'] = one_concede_home_rule
+                concedes_dict['lq_one_concede_home'] = one_concede_home
+                concedes_dict['lq_one_concede_guest_rule'] = one_concede_guest_rule
+                concedes_dict['lq_one_concede_guest'] = one_concede_guest
+            # 第二节让球
+            try:
+                two_concedes = result['o']["ahq2"]["v"]
+                two_concede_home_rule,two_concede_home,two_concede_guest_rule,two_concede_guest = rangqiu_daxiao(inner=two_concedes)
+                concedes_dict_rule['lq_two_concede_home'] = two_concede_home_rule
+                concedes_dict['lq_two_concede_home'] = two_concede_home
+                concedes_dict_rule['lq_two_concede_guest'] = two_concede_guest_rule
+                concedes_dict['lq_two_concede_guest'] = two_concede_guest
+            except:
+                two_concede_guest = ""
+                two_concede_guest_rule = ""
+                two_concede_home = ""
+                two_concede_home_rule = ""
+                concedes_dict_rule['lq_two_concede_home'] = two_concede_home_rule
+                concedes_dict['lq_two_concede_home'] = two_concede_home
+                concedes_dict_rule['lq_two_concede_guest'] = two_concede_guest_rule
+                concedes_dict['lq_two_concede_guest'] = two_concede_guest
+            # 第三节让球
+            try:
+                three_concedes = result['o']["ahq3"]["v"]
+                three_concede_home_rule,three_concede_home,three_concede_guest_rule,three_concede_guest = rangqiu_daxiao(inner=three_concedes)
+                concedes_dict_rule['lq_three_concede_home'] = three_concede_home_rule
+                concedes_dict['lq_three_concede_home'] = three_concede_home
+                concedes_dict_rule['lq_three_concede_guest'] = three_concede_guest_rule
+                concedes_dict['lq_three_concede_guest'] = three_concede_guest
+
+            except:
+                three_concede_guest = ""
+                three_concede_guest_rule = ""
+                three_concede_home = ""
+                three_concede_home_rule = ""
+                concedes_dict_rule['lq_three_concede_home'] = three_concede_home_rule
+                concedes_dict['lq_three_concede_home'] = three_concede_home
+                concedes_dict_rule['lq_three_concede_guest'] = three_concede_guest_rule
+                concedes_dict['lq_three_concede_guest'] = three_concede_guest
+            # 第四节让球
+            try:
+                four_concedes = result['o']["ahq4"]["v"]
+                four_concede_home_rule,four_concede_home,four_concede_guest_rule,four_concede_guest = rangqiu_daxiao(inner=four_concedes)
+                concedes_dict_rule['lq_four_concede_home'] = four_concede_home_rule
+                concedes_dict['lq_four_concede_home'] = four_concede_home
+                concedes_dict_rule['lq_four_concede_guest'] = four_concede_guest_rule
+                concedes_dict['lq_four_concede_guest'] = four_concede_guest
+
+            except:
+                four_concede_guest = ""
+                four_concede_guest_rule = ""
+                four_concede_home = ""
+                four_concede_home_rule = ""
+                concedes_dict_rule['lq_four_concede_home'] = four_concede_home_rule
+                concedes_dict['lq_four_concede_home'] = four_concede_home
+                concedes_dict_rule['lq_four_concede_guest'] = four_concede_guest_rule
+                concedes_dict['lq_four_concede_guest'] = four_concede_guest
+# ----------------------------------------总分大小分割线 - ---------------------------------------------------------------
+            # 全场总分大小
+            total_sizes_dict = {}
+            total_sizes_dict_rule = {}
+            try:
+                total_sizes = result['o']["ou"]["v"]
+                total_sizes_big_rule,total_sizes_big,total_sizes_small_rule,total_sizes_small = rangqiu_daxiao(inner=total_sizes)
+                total_sizes_dict_rule["lq_total_sizes_big"] = total_sizes_big_rule
+                total_sizes_dict["lq_total_sizes_big"] = total_sizes_big
+                total_sizes_dict_rule["lq_total_sizes_small"] = total_sizes_small_rule
+                total_sizes_dict["lq_total_sizes_small"] = total_sizes_small
+            except:
+                total_sizes_big_rule = ""
+                total_sizes_big = ""
+                total_sizes_small_rule = ""
+                total_sizes_small = ""
+                total_sizes_dict_rule["lq_total_sizes_big"] = total_sizes_big_rule
+                total_sizes_dict["lq_total_sizes_big"] = total_sizes_big
+                total_sizes_dict_rule["lq_total_sizes_small"] = total_sizes_small_rule
+                total_sizes_dict["lq_total_sizes_small"] = total_sizes_small
+            # 上半场总分大小
+            try:
+                half_total_sizes = result['o']["ou1st"]["v"]
+                half_total_sizes_big_rule,half_total_sizes_big,half_total_sizes_small_rule,half_total_sizes_small = rangqiu_daxiao(inner=half_total_sizes)
+                total_sizes_dict_rule["lq_half_total_sizes_big"] = half_total_sizes_big_rule
+                total_sizes_dict["lq_half_total_sizes_big"] = half_total_sizes_big
+                total_sizes_dict_rule["lq_half_total_sizes_small"] = half_total_sizes_small_rule
+                total_sizes_dict["lq_half_total_sizes_small"] = half_total_sizes_small
+            except:
+                half_total_sizes_big_rule = ""
+                half_total_sizes_big = ""
+                half_total_sizes_small_rule = ""
+                half_total_sizes_small = ""
+                total_sizes_dict_rule["lq_half_total_sizes_big"] = half_total_sizes_big_rule
+                total_sizes_dict["lq_half_total_sizes_big"] = half_total_sizes_big
+                total_sizes_dict_rule["lq_half_total_sizes_small"] = half_total_sizes_small_rule
+                total_sizes_dict["lq_half_total_sizes_small"] = half_total_sizes_small
+            # 第一节总分大小
+            try:
+                one_total_sizes = result['o']["ou1st"]["v"]
+                one_total_sizes_big_rule,one_total_sizes_big,one_total_sizes_small_rule,one_total_sizes_small = rangqiu_daxiao(inner=one_total_sizes)
+                total_sizes_dict_rule["lq_one_total_sizes_big"] = one_total_sizes_big_rule
+                total_sizes_dict["lq_one_total_sizes_big"] = one_total_sizes_big
+                total_sizes_dict_rule["lq_one_total_sizes_small"] = one_total_sizes_small_rule
+                total_sizes_dict["lq_one_total_sizes_small"] = one_total_sizes_small
+            except:
+                one_total_sizes_big_rule = ""
+                one_total_sizes_big = ""
+                one_total_sizes_small_rule = ""
+                one_total_sizes_small = ""
+                total_sizes_dict_rule["lq_one_total_sizes_big"] = one_total_sizes_big_rule
+                total_sizes_dict["lq_one_total_sizes_big"] = one_total_sizes_big
+                total_sizes_dict_rule["lq_one_total_sizes_small"] = one_total_sizes_small_rule
+                total_sizes_dict["lq_one_total_sizes_small"] = one_total_sizes_small
+            # 第二节场总分大小
+            try:
+                two_total_sizes = result['o']["ou1st"]["v"]
+                two_total_sizes_big_rule,two_total_sizes_big,two_total_sizes_small_rule,two_total_sizes_small = rangqiu_daxiao(inner=two_total_sizes)
+                total_sizes_dict_rule["lq_two_total_sizes_big"] = two_total_sizes_big_rule
+                total_sizes_dict["lq_two_total_sizes_big"] = two_total_sizes_big
+                total_sizes_dict_rule["lq_two_total_sizes_small"] = two_total_sizes_small_rule
+                total_sizes_dict["lq_two_total_sizes_small"] = two_total_sizes_small
+            except:
+                two_total_sizes_big_rule = ""
+                two_total_sizes_big = ""
+                two_total_sizes_small_rule = ""
+                two_total_sizes_small = ""
+                total_sizes_dict_rule["lq_two_total_sizes_big"] = two_total_sizes_big_rule
+                total_sizes_dict["lq_two_total_sizes_big"] = two_total_sizes_big
+                total_sizes_dict_rule["lq_two_total_sizes_small"] = two_total_sizes_small_rule
+                total_sizes_dict["lq_two_total_sizes_small"] = two_total_sizes_small
+            # 第三节总分大小
+            try:
+                three_total_sizes = result['o']["ou1st"]["v"]
+                three_total_sizes_big_rule,three_total_sizes_big,three_total_sizes_small_rule,three_total_sizes_small = rangqiu_daxiao(inner=three_total_sizes)
+                total_sizes_dict_rule["lq_three_total_sizes_big"] = three_total_sizes_big_rule
+                total_sizes_dict["lq_three_total_sizes_big"] = three_total_sizes_big
+                total_sizes_dict_rule["lq_three_total_sizes_small"] = three_total_sizes_small_rule
+                total_sizes_dict["lq_three_total_sizes_small"] = three_total_sizes_small
+            except:
+                three_total_sizes_big_rule = ""
+                three_total_sizes_big = ""
+                three_total_sizes_small_rule = ""
+                three_total_sizes_small = ""
+                total_sizes_dict_rule["lq_three_total_sizes_big"] = three_total_sizes_big_rule
+                total_sizes_dict["lq_three_total_sizes_big"] = three_total_sizes_big
+                total_sizes_dict_rule["lq_three_total_sizes_small"] = three_total_sizes_small_rule
+                total_sizes_dict["lq_three_total_sizes_small"] = three_total_sizes_small
+            # 第四节总分大小
+            try:
+                four_total_sizes = result['o']["ou1st"]["v"]
+                four_total_sizes_big_rule,four_total_sizes_big,four_total_sizes_small_rule,four_total_sizes_small = rangqiu_daxiao(inner=four_total_sizes)
+                total_sizes_dict_rule["lq_four_total_sizes_big"] = four_total_sizes_big_rule
+                total_sizes_dict["lq_four_total_sizes_big"] = four_total_sizes_big
+                total_sizes_dict_rule["lq_four_total_sizes_small"] = four_total_sizes_small_rule
+                total_sizes_dict["lq_four_total_sizes_small"] = four_total_sizes_small
+            except:
+                four_total_sizes_big_rule = ""
+                four_total_sizes_big = ""
+                four_total_sizes_small_rule = ""
+                four_total_sizes_small = ""
+                total_sizes_dict_rule["lq_four_total_sizes_big"] = four_total_sizes_big_rule
+                total_sizes_dict["lq_four_total_sizes_big"] = four_total_sizes_big
+                total_sizes_dict_rule["lq_four_total_sizes_small"] = four_total_sizes_small_rule
+                total_sizes_dict["lq_four_total_sizes_small"] = four_total_sizes_small
+
+# ----------------------------------------总分单双分割线------------------------------------------------------------------
+            # 全场 总分单双
+            odd_evens_dict = {}
+            odd_evens_dict_rule = {}
+            try:
+                odd_evens = result['o']["oe"]["v"]
+                # # 全场 总分单, 全场 总分双
+                odd_even_odd, odd_even_even = danshaung_fun(inner=odd_evens)
+                odd_evens_dict["lq_two_sides_single"] = odd_even_odd
+                odd_evens_dict_rule['lq_two_sides_single'] = '单'
+                odd_evens_dict["lq_two_sides_double"] = odd_even_even
+                odd_evens_dict_rule['lq_two_sides_double'] = '双'
+            except:
+                odd_even_odd = ""
+                odd_even_even = ""
+                odd_evens_dict["lq_two_sides_single"] = odd_even_odd
+                odd_evens_dict_rule['lq_two_sides_single'] = '单'
+                odd_evens_dict["lq_two_sides_double"] = odd_even_even
+                odd_evens_dict_rule['lq_two_sides_double'] = '双'
+            # 上半场全场 总分单双
+
+            try:
+                half_odd_evens = result['o']["oe1st"]["v"]
+                # 上半场 总分单, 上半场 总分双
+                half_odd_even_odd,half_odd_even_even = danshaung_fun(inner=half_odd_evens)
+                odd_evens_dict["lq_two_sides_single"] = half_odd_even_odd
+                odd_evens_dict_rule['lq_two_sides_single'] = '单'
+                odd_evens_dict["lq_two_sides_double"] = half_odd_even_even
+                odd_evens_dict_rule['lq_two_sides_double'] = '双'
+            except:
+                half_odd_even_odd = ""
+                half_odd_even_even = ""
+                odd_evens_dict["lq_half_two_sides_single"] = half_odd_even_odd
+                odd_evens_dict_rule['lq_half_two_sides_single'] = '单'
+                odd_evens_dict["lq_half_two_sides_double"] = half_odd_even_even
+                odd_evens_dict_rule['lq_half_two_sides_double'] = '双'
+
+            # 总分:单/双-第一节
+            try:
+                one_odd_evens = result['o']["oeq1"]["v"]
+                one_odd_even_odd,one_odd_even_even = danshaung_fun(inner=one_odd_evens)
+                odd_evens_dict["lq_one_two_sides_single"] = one_odd_even_odd
+                odd_evens_dict_rule['lq_one_two_sides_single'] = '单'
+                odd_evens_dict["lq_one_two_sides_double"] = one_odd_even_even
+                odd_evens_dict_rule['lq_one_two_sides_double'] = '双'
+            except:
+                one_odd_even_odd = ""
+                one_odd_even_even = ""
+                odd_evens_dict["lq_one_two_sides_single"] = one_odd_even_odd
+                odd_evens_dict_rule['lq_one_two_sides_single'] = '单'
+                odd_evens_dict["lq_one_two_sides_double"] = one_odd_even_even
+                odd_evens_dict_rule['lq_one_two_sides_double'] = '双'
+
+
+            # 总分:单/双-第二节
+            try:
+                two_odd_evens = result['o']["oeq2"]["v"]
+                two_odd_even_odd,two_odd_even_even = danshaung_fun(inner=two_odd_evens)
+                odd_evens_dict["lq_two_two_sides_single"] = two_odd_even_odd
+                odd_evens_dict_rule['lq_two_two_sides_single'] = '单'
+                odd_evens_dict["lq_two_two_sides_double"] = two_odd_even_even
+                odd_evens_dict_rule['lq_two_two_sides_double'] = '双'
+            except:
+                two_odd_even_odd = ""
+                two_odd_even_even = ""
+                odd_evens_dict["lq_two_two_sides_single"] = two_odd_even_odd
+                odd_evens_dict_rule['lq_two_two_sides_single'] = '单'
+                odd_evens_dict["lq_two_two_sides_double"] = two_odd_even_even
+                odd_evens_dict_rule['lq_two_two_sides_double'] = '双'
+
+            # 总分:单/双-第三节
+            try:
+                three_odd_evens = result['o']["oeq3"]["v"]
+                three_odd_even_odd,three_odd_even_even = danshaung_fun(inner=three_odd_evens)
+                odd_evens_dict["lq_three_two_sides_single"] = three_odd_even_odd
+                odd_evens_dict_rule['lq_three_two_sides_single'] = '单'
+                odd_evens_dict["lq_three_two_sides_double"] = three_odd_even_even
+                odd_evens_dict_rule['lq_three_two_sides_double'] = '双'
+
+
+            except:
+                three_odd_even_odd = ""
+                three_odd_even_even = ""
+                odd_evens_dict["lq_three_two_sides_single"] = three_odd_even_odd
+                odd_evens_dict_rule['lq_three_two_sides_single'] = '单'
+                odd_evens_dict["lq_three_two_sides_double"] = three_odd_even_even
+                odd_evens_dict_rule['lq_three_two_sides_double'] = '双'
+
+
+
+            # 总分:单/双-第四节
+            try:
+                four_odd_evens = result['o']["oeq4"]["v"]
+                four_odd_even_odd,four_odd_even_even = danshaung_fun(inner=four_odd_evens)
+                odd_evens_dict["lq_four_two_sides_single"] = four_odd_even_odd
+                odd_evens_dict_rule['lq_four_two_sides_single'] = '单'
+                odd_evens_dict["lq_four_two_sides_double"] = four_odd_even_even
+                odd_evens_dict_rule['lq_four_two_sides_double'] = '双'
+            except:
+                four_odd_even_odd = ""
+                four_odd_even_even = ""
+                odd_evens_dict["lq_four_two_sides_single"] = four_odd_even_odd
+                odd_evens_dict_rule['lq_four_two_sides_single'] = '单'
+                odd_evens_dict["lq_four_two_sides_double"] = four_odd_even_even
+                odd_evens_dict_rule['lq_four_two_sides_double'] = '双'
+
+# ----------------------------------------球队得分最后一位数分割线---------------------------------------------------------
+            # 球队得分最后一位数 主队
+            last_numbers_dict = {}
+            try:
+                last_numbers = result["p-o"][0]['o']
+                last_home = {}
+                for last_number in last_numbers:
+                    last_home[last_number[0]] = last_number[2]
+            except:
+                last_home = {}
+            last_numbers_dict["lq_last_home"] = last_home
+            # 球队得分最后一位数 客队
+            try:
+                new_last_numbers = result["p-o"][1]['o']
+                last_guest = {}
+                for new_last_number in new_last_numbers:
+                    last_guest[new_last_number[0]] = new_last_number[2]
+            except:
+                last_guest = {}
+            last_numbers_dict["lq_last_guest"] = last_guest
+# ------------------------------------------------------独赢分割线---------------------------------------------------------
+            capots_dict = {}
+            # 独赢
+            try:
+                capots = result['o']["ml"]["v"]
+                capot_list = [capots[i] for i in range(len(capots)) if i % 2 == 1]
+                capot_home = capot_list[0]
+                capot_guest = capot_list[1]
+                capots_dict["lq_capot_home"] = capot_home
+                capots_dict["lq_capot_guest"] = capot_guest
+            except:
+                capot_home = ""
+                capot_guest = ""
+                capots_dict["lq_capot_home"] = capot_home
+                capots_dict["lq_capot_guest"] = capot_guest
+
+            # 上半场独赢
+            try:
+                half_capots = result['o']["ml1st"]["v"]
+                half_capot_list = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
+                half_capot_home = half_capot_list[0]
+                half_capot_guest = half_capot_list[1]
+                capots_dict["lq_half_capot_home"] = half_capot_home
+                capots_dict["lq_half_capot_guest"] = half_capot_guest
+            except:
+                half_capot_home = ""
+                half_capot_guest = ""
+                capots_dict["lq_half_capot_home"] = half_capot_home
+                capots_dict["lq_half_capot_guest"] = half_capot_guest
+
+            # 第一节独赢
+            try:
+                one_capots = result['o']["mlq1"]["v"]
+                one_capot_list = [one_capots[i] for i in range(len(one_capots)) if i % 2 == 1]
+                one_capot_home = one_capot_list[0]
+                one_capot_guest = one_capot_list[1]
+                capots_dict["lq_one_capot_home"] = one_capot_home
+                capots_dict["lq_one_capot_guest"] = one_capot_guest
+            except:
+                one_capot_home = ""
+                one_capot_guest = ""
+                capots_dict["lq_one_capot_home"] = one_capot_home
+                capots_dict["lq_one_capot_guest"] = one_capot_guest
+
+            # 第二节独赢
+            try:
+                two_capots = result['o']["mlq2"]["v"]
+                two_capot_list = [two_capots[i] for i in range(len(two_capots)) if i % 2 == 1]
+                two_capot_home = two_capot_list[0]
+                two_capot_guest = two_capot_list[1]
+                capots_dict["lq_two_capot_home"] = two_capot_home
+                capots_dict["lq_two_capot_guest"] = two_capot_guest
+            except:
+                two_capot_home = ""
+                two_capot_guest = ""
+                capots_dict["lq_two_capot_home"] = two_capot_home
+                capots_dict["lq_two_capot_guest"] = two_capot_guest
+
+            # 第三节独赢
+            try:
+                three_capots = result['o']["mlq3"]["v"]
+                three_capot_list = [three_capots[i] for i in range(len(three_capots)) if i % 2 == 1]
+                three_capot_home = three_capot_list[0]
+                three_capot_guest = three_capot_list[1]
+                capots_dict["lq_three_capot_home"] = three_capot_home
+                capots_dict["lq_three_capot_guest"] = three_capot_guest
+            except:
+                three_capot_home = ""
+                three_capot_guest = ""
+                capots_dict["lq_three_capot_home"] = three_capot_home
+                capots_dict["lq_three_capot_guest"] = three_capot_guest
+
+            # 第四节独赢
+            try:
+                four_capots = result['o']["mlq2"]["v"]
+                four_capot_list = [four_capots[i] for i in range(len(four_capots)) if i % 2 == 1]
+                four_capot_home = four_capot_list[0]
+                four_capot_guest = four_capot_list[1]
+                capots_dict["lq_four_capot_home"] = four_capot_home
+                capots_dict["lq_four_capot_guest"] = four_capot_guest
+            except:
+                four_capot_home = ""
+                four_capot_guest = ""
+                capots_dict["lq_four_capot_home"] = four_capot_home
+                capots_dict["lq_four_capot_guest"] = four_capot_guest
+
+# ---------------------------------------------------华丽分割线列表es[1]--------------------------------------------------
+            # 球队得分 全场主队 home
+            team_scores_dict = {}
+            team_scores_dict_rule = {}
+            try:
+                score_home = new_data[1]
+            except:
+                score_home = ""
+            print(game_id)
+            if score_home:
+                try:
+                    score_homes = score_home["o"]["ou"]['v']
+                    score_home_big_rule,score_home_big,score_home_small_rule,score_home_small = rangqiu_daxiao(inner=score_homes)
+                    team_scores_dict_rule["lq_score_home_big"] = score_home_big_rule
+                    team_scores_dict["lq_score_home_big"] = score_home_big
+                    team_scores_dict_rule["lq_score_home_small"] = score_home_small_rule
+                    team_scores_dict["lq_score_home_small"] = score_home_small
+                except:
+                    score_home_small = ""
+                    score_home_small_rule = ""
+                    score_home_big_rule = ""
+                    score_home_big = ""
+                    team_scores_dict_rule["lq_score_home_big"] = score_home_big_rule
+                    team_scores_dict["lq_score_home_big"] = score_home_big
+                    team_scores_dict_rule["lq_score_home_small"] = score_home_small_rule
+                    team_scores_dict["lq_score_home_small"] = score_home_small
+                # 球队得分 上半场主队 home
+                try:
+                    half_score_homes = score_home['o']['ou1st']['v']
+                    # 球队得分 上半场主队 大条件
+                    half_score_home_big_rule,half_score_home_big,half_score_home_small_rule,half_score_home_small = rangqiu_daxiao(inner=half_score_homes)
+                    team_scores_dict_rule["lq_half_score_home_big"] = half_score_home_big_rule
+                    team_scores_dict["lq_half_score_home_big"] = half_score_home_big
+                    team_scores_dict_rule["lq_half_score_home_small"] = half_score_home_small_rule
+                    team_scores_dict["lq_half_score_home_small"] = half_score_home_small
+                except:
+                    half_score_home_small = ""
+                    half_score_home_small_rule = ""
+                    half_score_home_big = ""
+                    half_score_home_big_rule = ""
+                    team_scores_dict_rule["lq_half_score_home_big"] = half_score_home_big_rule
+                    team_scores_dict["lq_half_score_home_big"] = half_score_home_big
+                    team_scores_dict_rule["lq_half_score_home_small"] = half_score_home_small_rule
+                    team_scores_dict["lq_half_score_home_small"] = half_score_home_small
+
+                # 球队得分:主队-大 / 小-第一节
+                try:
+                    one_score_homes = score_home['o']["ouq1"]["v"]
+                    one_score_home_big_rule,one_score_home_big,one_score_home_small_rule,one_score_home_small = rangqiu_daxiao(inner=one_score_homes)
+                    team_scores_dict_rule["lq_one_score_home_big"] = one_score_home_big_rule
+                    team_scores_dict["lq_one_score_home_big"] = one_score_home_big
+                    team_scores_dict_rule["lq_one_score_home_small"] = one_score_home_small_rule
+                    team_scores_dict["lq_one_score_home_small"] = one_score_home_small
+                except:
+                    one_score_home_small = ""
+                    one_score_home_small_rule = ""
+                    one_score_home_big = ""
+                    one_score_home_big_rule = ""
+                    team_scores_dict_rule["lq_one_score_home_big"] = one_score_home_big_rule
+                    team_scores_dict["lq_one_score_home_big"] = one_score_home_big
+                    team_scores_dict_rule["lq_one_score_home_small"] = one_score_home_small_rule
+                    team_scores_dict["lq_one_score_home_small"] = one_score_home_small
+
+                # 球队得分:主队-大 / 小-第一节
+                try:
+                    two_score_homes = score_home['o']["ouq2"]["v"]
+                    two_score_home_big_rule,two_score_home_big,two_score_home_small_rule,two_score_home_small = rangqiu_daxiao(inner=two_score_homes)
+                    team_scores_dict_rule["lq_two_score_home_big"] = two_score_home_big_rule
+                    team_scores_dict["lq_two_score_home_big"] = two_score_home_big
+                    team_scores_dict_rule["lq_two_score_home_small"] = two_score_home_small_rule
+                    team_scores_dict["lq_two_score_home_small"] = two_score_home_small
+                except:
+                    two_score_home_small = ""
+                    two_score_home_small_rule = ""
+                    two_score_home_big = ""
+                    two_score_home_big_rule = ""
+                    team_scores_dict_rule["lq_two_score_home_big"] = two_score_home_big_rule
+                    team_scores_dict["lq_two_score_home_big"] = two_score_home_big
+                    team_scores_dict_rule["lq_two_score_home_small"] = two_score_home_small_rule
+                    team_scores_dict["lq_two_score_home_small"] = two_score_home_small
+
+                # 球队得分:主队-大 / 小-第一节
+                try:
+                    three_score_homes = score_home['o']["ouq3"]["v"]
+                    three_score_home_big_rule,three_score_home_big,three_score_home_small_rule,three_score_home_small = rangqiu_daxiao(inner=three_score_homes)
+                    team_scores_dict_rule["lq_three_score_home_big"] = three_score_home_big_rule
+                    team_scores_dict["lq_three_score_home_big"] = three_score_home_big
+                    team_scores_dict_rule["lq_three_score_home_small"] = three_score_home_small_rule
+                    team_scores_dict["lq_three_score_home_small"] = three_score_home_small
+                except:
+                    three_score_home_small = ""
+                    three_score_home_small_rule = ""
+                    three_score_home_big = ""
+                    three_score_home_big_rule = ""
+                    team_scores_dict_rule["lq_three_score_home_big"] = three_score_home_big_rule
+                    team_scores_dict["lq_three_score_home_big"] = three_score_home_big
+                    team_scores_dict_rule["lq_three_score_home_small"] = three_score_home_small_rule
+                    team_scores_dict["lq_three_score_home_small"] = three_score_home_small
+
+                # 球队得分:主队-大 / 小-第四节
+                try:
+                    four_score_homes = score_home['o']["ouq4"]["v"]
+                    four_score_home_big_rule,four_score_home_big,four_score_home_small_rule,four_score_home_small = rangqiu_daxiao(inner=four_score_homes)
+                    team_scores_dict_rule["lq_four_score_home_big"] = four_score_home_big_rule
+                    team_scores_dict["lq_four_score_home_big"] = four_score_home_big
+                    team_scores_dict_rule["lq_four_score_home_small"] = four_score_home_small_rule
+                    team_scores_dict["lq_four_score_home_small"] = four_score_home_small
+                except:
+                    four_score_home_small = ""
+                    four_score_home_small_rule = ""
+                    four_score_home_big = ""
+                    four_score_home_big_rule = ""
+                    team_scores_dict_rule["lq_four_score_home_big"] = four_score_home_big_rule
+                    team_scores_dict["lq_four_score_home_big"] = four_score_home_big
+                    team_scores_dict_rule["lq_four_score_home_small"] = four_score_home_small_rule
+                    team_scores_dict["lq_four_score_home_small"] = four_score_home_small
+
+
+# ---------------------------------------------------华丽分割线列表es[2]--------------------------------------------------
+            # 球队得分 客队 guest
+            try:
+                score_guest = new_data[2]
+            except:
+                score_guest = ""
+            if score_guest:
+                try:
+                    # 球队得分: 大 / 小
+                    score_guests = score_guest["o"]["ou"]['v']
+                    score_guest_big_rule,score_guest_big,score_guest_small_rule,score_guest_small = rangqiu_daxiao(inner=score_guests)
+                    team_scores_dict_rule["lq_score_guest_big"] = score_guest_big_rule
+                    team_scores_dict["lq_score_guest_big"] = score_guest_big
+                    team_scores_dict_rule["lq_score_guest_small"] = score_guest_small_rule
+                    team_scores_dict["lq_score_guest_small"] = score_guest_small
+                except:
+                    score_guest_small = ""
+                    score_guest_small_rule = ""
+                    score_guest_big = ""
+                    score_guest_big_rule = ""
+                    team_scores_dict_rule["lq_score_guest_big"] = score_guest_big_rule
+                    team_scores_dict["lq_score_guest_big"] = score_guest_big
+                    team_scores_dict_rule["lq_score_guest_small"] = score_guest_small_rule
+                    team_scores_dict["lq_score_guest_small"] = score_guest_small
+
+                # 球队得分 上半场客队 guest
+                try:
+                    half_score_guests = score_guest["o"]['ou1st']['v']
+                    half_score_guest_big_rule,half_score_guest_big,half_score_guest_small_rule,half_score_guest_small = rangqiu_daxiao(inner=half_score_guests)
+                    team_scores_dict_rule["lq_half_score_guest_big"] = half_score_guest_big_rule
+                    team_scores_dict["lq_half_score_guest_big"] = half_score_guest_big
+                    team_scores_dict_rule["lq_half_score_guest_small"] = half_score_guest_small_rule
+                    team_scores_dict["lq_half_score_guest_small"] = half_score_guest_small
+                except:
+                    half_score_guest_small = ""
+                    half_score_guest_small_rule = ""
+                    half_score_guest_big = ""
+                    half_score_guest_big_rule = ""
+                    team_scores_dict_rule["lq_half_score_guest_big"] = half_score_guest_big_rule
+                    team_scores_dict["lq_half_score_guest_big"] = half_score_guest_big
+                    team_scores_dict_rule["lq_half_score_guest_small"] = half_score_guest_small_rule
+                    team_scores_dict["lq_half_score_guest_small"] = half_score_guest_small
+                # 球队得分第一节
+                try:
+                    one_score_guests = score_guest["o"]['ouq1']['v']
+                    one_score_guest_big_rule, one_score_guest_big, one_score_guest_small_rule, one_score_guest_small = rangqiu_daxiao(
+                        inner=one_score_guests)
+                    team_scores_dict_rule["lq_one_score_guest_big"] = one_score_guest_big_rule
+                    team_scores_dict["lq_one_score_guest_big"] = one_score_guest_big
+                    team_scores_dict_rule["lq_one_score_guest_small"] = one_score_guest_small_rule
+                    team_scores_dict["lq_one_score_guest_small"] = one_score_guest_small
+                except:
+                    one_score_guest_small = ""
+                    one_score_guest_small_rule = ""
+                    one_score_guest_big = ""
+                    one_score_guest_big_rule = ""
+                    team_scores_dict_rule["lq_one_score_guest_big"] = one_score_guest_big_rule
+                    team_scores_dict["lq_one_score_guest_big"] = one_score_guest_big
+                    team_scores_dict_rule["lq_one_score_guest_small"] = one_score_guest_small_rule
+                    team_scores_dict["lq_one_score_guest_small"] = one_score_guest_small
+
+                # 球队得分第二节
+                try:
+                    two_score_guests = score_guest["o"]['ouq2']['v']
+                    two_score_guest_big_rule, two_score_guest_big, two_score_guest_small_rule, two_score_guest_small = rangqiu_daxiao(
+                        inner=two_score_guests)
+                    team_scores_dict_rule["lq_two_score_guest_big"] = two_score_guest_big_rule
+                    team_scores_dict["lq_two_score_guest_big"] = two_score_guest_big
+                    team_scores_dict_rule["lq_two_score_guest_small"] = two_score_guest_small_rule
+                    team_scores_dict["lq_two_score_guest_small"] = two_score_guest_small
+                except:
+                    two_score_guest_small = ""
+                    two_score_guest_small_rule = ""
+                    two_score_guest_big = ""
+                    two_score_guest_big_rule = ""
+                    team_scores_dict_rule["lq_two_score_guest_big"] = two_score_guest_big_rule
+                    team_scores_dict["lq_two_score_guest_big"] = two_score_guest_big
+                    team_scores_dict_rule["lq_two_score_guest_small"] = two_score_guest_small_rule
+                    team_scores_dict["lq_two_score_guest_small"] = two_score_guest_small
+                # 球队得分第三节
+                try:
+                    three_score_guests = score_guest["o"]['ouq3']['v']
+                    three_score_guest_big_rule, three_score_guest_big, three_score_guest_small_rule, three_score_guest_small = rangqiu_daxiao(
+                        inner=three_score_guests)
+                    team_scores_dict_rule["lq_three_score_guest_big"] = three_score_guest_big_rule
+                    team_scores_dict["lq_three_score_guest_big"] = three_score_guest_big
+                    team_scores_dict_rule["lq_three_score_guest_small"] = three_score_guest_small_rule
+                    team_scores_dict["lq_three_score_guest_small"] = three_score_guest_small
+                except:
+                    three_score_guest_small = ""
+                    three_score_guest_small_rule = ""
+                    three_score_guest_big = ""
+                    three_score_guest_big_rule = ""
+                    team_scores_dict_rule["lq_three_score_guest_big"] = three_score_guest_big_rule
+                    team_scores_dict["lq_three_score_guest_big"] = three_score_guest_big
+                    team_scores_dict_rule["lq_three_score_guest_small"] = three_score_guest_small_rule
+                    team_scores_dict["lq_three_score_guest_small"] = three_score_guest_small
+                # 球队得分第四节
+                try:
+                    four_score_guests = score_guest["o"]['ouq4']['v']
+                    four_score_guest_big_rule, four_score_guest_big, four_score_guest_small_rule, four_score_guest_small = rangqiu_daxiao(
+                        inner=four_score_guests)
+                    team_scores_dict_rule["lq_four_score_guest_big"] = four_score_guest_big_rule
+                    team_scores_dict["lq_four_score_guest_big"] = four_score_guest_big
+                    team_scores_dict_rule["lq_four_score_guest_small"] = four_score_guest_small_rule
+                    team_scores_dict["lq_four_score_guest_small"] = four_score_guest_small
+                except:
+                    four_score_guest_small = ""
+                    four_score_guest_small_rule = ""
+                    four_score_guest_big = ""
+                    four_score_guest_big_rule = ""
+                    team_scores_dict_rule["lq_four_score_guest_big"] = four_score_guest_big_rule
+                    team_scores_dict["lq_four_score_guest_big"] = four_score_guest_big
+                    team_scores_dict_rule["lq_four_score_guest_small"] = four_score_guest_small_rule
+                    team_scores_dict["lq_four_score_guest_small"] = four_score_guest_small
+
+            # 联赛id
+            item['league_id'] = league_id
+            # 联赛名
+            item['league_name'] = league_name
+            # item['result'] = result
+            # 比赛id
+            item['game_id'] = game_id
+            # 球队1
+            item['team_home'] = team_home
+            # 球队2
+            item['team_guest'] = team_guest
+            # 数量(97>)
+            item['number'] = number
+            # 比赛状态
+            item['zhuangtai'] = zhuangtai
+            # 日期
+            item['data_game'] = data_game
+            # 开赛时间
+            item['time_game'] = time_game
+            # 队1分数
+            item['score_home'] = score_home1
+            # 队2分数
+            item['score_guest'] = score_guest1
+            # 第几节
+            item['jijie'] = jijie
+            item['pt'] = pt
+            # 球队得分
+            item['qiudui'] = qiudui
+            item['concede'] = concedes_dict
+            item['concede_rule'] = concedes_dict_rule
+            item['odd_even'] = odd_evens_dict
+            item['odd_even_rule'] = odd_evens_dict_rule
+            item['total_size'] = total_sizes_dict
+            item['total_size_rule'] = total_sizes_dict_rule
+            item['last_number'] = last_numbers_dict
+            item['capot'] = capots_dict
+            item['team_score'] = team_scores_dict
+            item['team_score_rule'] = team_scores_dict_rule
+            yield item
+
+
+
+
+
+
+
+
+
+

+ 58 - 0
new_hg3535s/hg3535/spiders/liansai.py

@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+import json
+
+import scrapy
+
+# from scrapy.http import Request
+
+from .. items import Liansai
+
+
+class LanqiulsSpider(scrapy.Spider):
+    name = 'liansai'
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            'hg3535.pipelines.Liansaipipeline': 300,
+        }
+    }
+
+    def start_requests(self):
+        for y in range(1, 5):
+            for i in range(1, 5):
+                url = 'http://hg3535z.com/odds2/d/getcomps?sid='+str(y)+'&pt=' + str(i) + '&ubt=am&dc=null&pn=0&pid=0'
+                yield scrapy.Request(url=url, callback=self.parse)
+
+    def parse(self, response):
+        try:
+            datas = json.loads(response.text)['gs']
+        except:
+            datas = ""
+        if datas:
+            for data in datas:
+                # 区域id,欧洲
+                area_id = data['gid']
+                # 区域名,欧洲
+                area_name = data['gn']
+                new_data = data['fc']
+                if new_data:
+                    for i in new_data:
+                        item = Liansai()
+                        ball = json.loads(response.text)['s']
+                        st_league = i["id"]
+                        name_chinese = i['nm']
+                        item['area_id'] = area_id
+                        item['area_name'] = area_name
+                        item['st_league'] = st_league
+                        item['name_chinese'] = name_chinese
+                        item['ball'] = ball
+                        yield item
+
+
+
+
+
+
+
+
+

+ 257 - 0
new_hg3535s/hg3535/spiders/wangqiu.py

@@ -0,0 +1,257 @@
+# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
+import copy
+import json
+
+import scrapy
+from scrapy.http import Request
+
+from ..items import Wangqiu
+
+
+class LanqiuSpider(scrapy.Spider):
+
+    name = "wangqiu"
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            "hg3535.pipelines.Wangqiupipeline": 300,
+        }
+    }
+    def start_requests(self):
+        # newall_lists = ['am', 'ftht1x2', 'oe', 'tg', 'htft', 'cs', 'fglg', 'or']
+        for y in range(1, 4):
+            url = 'http://hg3535z.com/odds2/d/getodds?sid=3&pt='+str(y)+'&ubt=am&pn=0&sb=2&dc=null&pid=0'
+            yield scrapy.Request(url=url, callback=self.parse, meta={'pt': y, 'dont_redirect': True})
+
+    def parse(self, response):
+        if response.text:
+            try:
+                datas = json.loads(response.text).get('n-ot', "").get('egs', "")
+            except:
+                datas = ""
+            try:
+                pt = copy.copy(response.meta['pt'])
+            except:
+                pt = 0
+            if datas:
+                for result in datas:
+                    new_results = result['es']
+                    for new_result in new_results:
+                        game_id = str(new_result['i'][16])
+                        if pt == 1:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=false"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 2:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=false"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 3:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid=" + game_id + "iip=false&ubt=am&isp=true"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        # http://hg3535z.com/odds2/d/getamodds?eid=3120299&iip=false&ubt=am&isp=false
+    def parse_each(self, response):
+        try:
+            new_datas = json.loads(response.text)['eg']
+        except:
+            new_datas = ""
+        try:
+            pt = response.meta['pt']
+        except:
+            pt = 0
+        if new_datas:
+            # 联赛id
+            league_id = new_datas["c"]["k"]
+            # 联赛名
+            league_name = new_datas["c"]["n"]
+            new_data = new_datas["es"]
+            for result in new_data:
+                item = Wangqiu()
+                # 比赛id
+                game_id = str(result['k'])
+                # 球队1
+                team_home = result['i'][0]
+                # 球队2
+                team_guest = result['i'][1]
+                # 数量(97>)
+                number = result['i'][2]
+                # 比赛状态
+                zhuangtai = result['i'][3]
+                # 日期
+                data_game = result['i'][4]
+                # 开赛时间
+                time_game = result['i'][5]
+                # 队1分数
+                score_home1 = result['i'][10]
+                # 队2分数
+                score_guest1 = result['i'][11]
+                # 第几盘
+                jijie = result['i'][12]
+                # 球队得分
+                qiudui = result['pci'].get('ctn', "")
+# --------------------------------------------------让盘分割线-----------------------------------------------------------
+                concedes_dict = {}
+                concedes_dict_rule = {}
+                try:
+                    concedes = result['o']["ah"]["v"]
+                    # concedes_dict_rule['wq_concede_home'] = concedes[1]
+                    home_rule = concedes[1]
+                    if home_rule.startswith('+'):
+                        n_home_rule = home_rule.replace('+', '-')
+                        concedes_dict_rule['wq_concede_home'] = n_home_rule
+                    if home_rule.startswith('-'):
+                        n_home_rule = home_rule.replace('-', '+')
+                        concedes_dict_rule['wq_concede_home'] = n_home_rule
+                    concedes_dict['wq_concede_home'] = concedes[5]
+                    # concedes_dict_rule['wq_concede_guest'] = concedes[3]
+                    guest_rule = concedes[3]
+                    if guest_rule.startswith('+'):
+                        n_guest_rule = guest_rule.replace('+', '-')
+                        concedes_dict_rule['wq_concede_guest'] = n_guest_rule
+                    if guest_rule.startswith('-'):
+                        n_guest_rule = guest_rule.replace('-', '+')
+                        concedes_dict_rule['wq_concede_guest'] = n_guest_rule
+                    concedes_dict['wq_concede_guest'] = concedes[7]
+                except:
+                    concedes_dict_rule['wq_concede_home'] = ""
+                    concedes_dict['wq_concede_home'] = ""
+                    concedes_dict_rule['wq_concede_guest'] = ""
+                    concedes_dict['wq_concede_guest'] = ""
+                # print(concedes_dict)
+# ---------------------------------------------------冠军----------------------------------------------------------------
+                kemps_dict = {}
+                try:
+                    kemps = result['o']["ml"]["v"]
+                    kemps_dict['wq_kemp_home'] = kemps[1]
+                    kemps_dict['wq_kemp_guest'] = kemps[3]
+
+                except:
+                    kemps_dict['wq_kemp_home'] = ""
+                    kemps_dict['wq_kemp_guest'] = ""
+                # 第一盘 冠军
+                try:
+                    kemps = result['o']["mls1"]["v"]
+                    kemps_dict['wq_one_kemp_home'] = kemps[1]
+                    kemps_dict['wq_one_kemp_guest'] = kemps[3]
+
+                except:
+                    kemps_dict['wq_one_kemp_home'] = ""
+                    kemps_dict['wq_one_kemp_guest'] = ""
+
+# ---------------------------------------------------让局---------------------------------------------------------------
+
+                bureaus_dict = {}
+                bureaus_dict_rule = {}
+                try:
+                    bureaus = result['o']["ahfts"]["v"]
+                    # bureaus_dict_rule['wq_bureau_home'] = bureaus[1]
+                    home_rule = bureaus[1]
+                    if home_rule.startswith('+'):
+                        n_home_rule = home_rule.replace('+', '-')
+                        bureaus_dict_rule['wq_bureau_home'] = n_home_rule
+                    if home_rule.startswith('-'):
+                        n_home_rule = home_rule.replace('-', '+')
+                        bureaus_dict_rule['wq_bureau_home'] = n_home_rule
+                    else:
+                        bureaus_dict_rule['wq_bureau_home'] = home_rule
+                    bureaus_dict['wq_bureau_home'] = bureaus[5]
+                    # bureaus_dict_rule['wq_bureau_guest'] = bureaus[3]
+                    guest_rule = bureaus[3]
+                    if guest_rule.startswith('+'):
+                        n_guest_rule = guest_rule.replace('+', '-')
+                        bureaus_dict_rule['wq_bureau_guest'] = n_guest_rule
+                    if guest_rule.startswith('-'):
+                        n_guest_rule = guest_rule.replace('-', '+')
+                        bureaus_dict_rule['wq_bureau_guest'] = n_guest_rule
+                    else:
+                        bureaus_dict_rule['wq_bureau_guest'] = guest_rule
+                    bureaus_dict['wq_bureau_guest'] = bureaus[7]
+                except:
+                    bureaus_dict_rule['wq_bureau_home'] = ""
+                    bureaus_dict['wq_bureau_home'] = ""
+                    bureaus_dict_rule['wq_bureau_guest'] = ""
+                    bureaus_dict['wq_bureau_guest'] = ""
+
+# -----------------------------------------------------总局数:大/小------------------------------------------------------
+                total_number_dict = {}
+                total_number_dict_rule = {}
+                try:
+                    total_numbers = result['o']["oufts"]["v"]
+                    total_number_dict_rule['wq_total_number_big'] = total_numbers[1]
+                    total_number_dict['wq_total_number_big'] = total_numbers[5]
+                    total_number_dict_rule['wq_total_number_small'] = total_numbers[3]
+                    total_number_dict['wq_total_number_small'] = total_numbers[7]
+                except:
+                    total_number_dict_rule['wq_total_number_big'] = ""
+                    total_number_dict['wq_total_number_big'] = ""
+                    total_number_dict_rule['wq_total_number_small'] = ""
+                    total_number_dict['wq_total_number_small'] = ""
+
+# ------------------------------------------------------总局数:单/双-----------------------------------------------------
+                odd_evens_dict = {}
+                odd_evens_dict_rule = {}
+                try:
+                    odd_evens = result['o']["oefts"]["v"]
+                    # 上半场 主队让球条件
+                    odd_evens_dict['wq_two_sides_single'] = odd_evens[1]
+                    odd_evens_dict_rule['wq_two_sides_single'] = "单"
+                    odd_evens_dict['wq_two_sides_double'] = odd_evens[3]
+                    odd_evens_dict_rule['wq_two_sides_double'] = "双"
+
+                except:
+                    odd_evens_dict['wq_two_sides_single'] = ""
+                    odd_evens_dict['wq_two_sides_single'] = ""
+                    odd_evens_dict_rule['wq_two_sides_double'] = ""
+                    odd_evens_dict_rule['wq_two_sides_double'] = ""
+
+                # 联赛id
+                item['league_id'] = league_id
+                # 联赛名
+                item['league_name'] = league_name
+                # 比赛id
+                item['game_id'] = game_id
+                # 球队1
+                item['team_home'] = team_home
+                # 球队2
+                item['team_guest'] = team_guest
+                # 数量(97>)
+                item['number'] = number
+                # 比赛状态
+                item['zhuangtai'] = zhuangtai
+                # 日期
+                item['data_game'] = data_game
+                # 开赛时间
+                item['time_game'] = time_game
+                # 队1分数
+                item['score_home'] = score_home1
+                # 队2分数
+                item['score_guest'] = score_guest1
+                # 第几节
+                item['jijie'] = jijie
+                item['pt'] = pt
+                # 球队得分
+                item['qiudui'] = qiudui
+                # 让盘
+                item['concedes_dict'] = concedes_dict
+                item['concedes_dict_rule'] = concedes_dict_rule
+                # 冠军
+                item['kemps_dict'] = kemps_dict
+                # 让局
+                item['bureaus_dict'] = bureaus_dict
+                item['bureaus_dict_rule'] = bureaus_dict_rule
+                # 总局数大小
+                item['total_number_dict'] = total_number_dict
+                item['total_number_dict_rule'] = total_number_dict_rule
+                # 总局数单双
+                item['odd_evens_dict'] = odd_evens_dict
+                item['odd_evens_dict_rule'] = odd_evens_dict_rule
+                yield item
+
+
+
+
+
+
+
+
+
+

+ 110 - 0
new_hg3535s/hg3535/spiders/wgbodan.py

@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+import json
+
+import scrapy
+
+from scrapy.http import Request
+
+from ..items import Wqbodan
+
+
+class WgbodanSpider(scrapy.Spider):
+    name = 'wgbodan'
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            'hg3535.pipelines.Wqbodanpipeline': 300,
+        }
+    }
+
+    def start_requests(self):
+        url = 'http://hg3535z.com/odds2/d/getmenu?pid=0'
+        yield scrapy.Request(url=url, callback=self.parse_one)
+
+    def parse_one(self, response):
+        for y in range(1, 4):
+            url = 'http://hg3535z.com/odds2/d/getodds?sid=3&pt=' + str(y) + '&ubt=stcs&pn=0&sb=2&dc=null&pid=0'
+            yield Request(url=url, callback=self.parse, meta={'pt': y})
+
+    def parse(self, response):
+        try:
+            datas = json.loads(response.text)
+        except:
+            datas = ""
+        try:
+            results = datas['n-ot']['egs']
+        except:
+            results = ""
+        try:
+            pt = copy.copy(response.meta['pt'])
+        except:
+            pt = 0
+        if results:
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    item = Wqbodan()
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 状态
+                    zhuangtai = new_result['i'][3]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn', "")
+                    bodan_data = {}
+                    # 波胆
+                    bodans = new_result['o'].get('sb', "")
+                    if bodans:
+                        one_list = ["wq_bodanhome_two_zero", "wq_bodanhome_two_one", "wq_bodanhome_three_zero",
+                                    "wq_bodanhome_three_one", "wq_bodanhome_three_two", "wq_bodanhome_four_zero",
+                                    "wq_bodanhome_four_one", "wq_bodanhome_four_two", "wq_bodanhome_four_three"]
+                        two_list = ["wq_bodanguest_two_zero", "wq_bodanguest_two_one", "wq_bodanguest_three_zero",
+                                    "wq_bodanguest_three_one", "wq_bodanguest_three_two", "wq_bodanguest_four_zero",
+                                    "wq_bodanguest_four_one", "wq_bodanguest_four_two", "wq_bodanguest_four_three"]
+
+                        new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 == 1]
+                        # 主队bodan_home
+                        bodan_home = [new_bodans[i] for i in range(len(new_bodans)) if i % 2 == 0]
+                        for index, t in enumerate(one_list):
+                            bodan_data[t] = bodan_home[index]
+                        # 客队bodan_guest
+                        bodan_guest = [new_bodans[i] for i in range(len(new_bodans)) if i % 2 == 1]
+                        for y, z in enumerate(two_list):
+                            bodan_data[z] = bodan_guest[y]
+                    item['league_id'] = league_id
+                    item['league_name'] = league_name
+                    item['game_id'] = game_id
+                    item['team_home'] = team_home
+                    item['team_guest'] = team_guest
+                    item['number'] = number
+                    item['data_game'] = data_game
+                    item['time_game'] = time_game
+                    item['corner_ball'] = corner_ball
+                    item['score_home'] = score_home
+                    item['score_guest'] = score_guest
+                    item['half_way'] = half_way
+                    item['pt'] = pt
+                    item['zhuangtai'] = zhuangtai
+                    item['bodan_data'] = bodan_data
+                    yield item
+
+

+ 552 - 0
new_hg3535s/hg3535/spiders/zuqiu.py

@@ -0,0 +1,552 @@
+# -*- coding: utf-8 -*-
+import copy
+import json
+
+import scrapy
+from scrapy.http import Request
+
+from .. items import Zuqiu
+
+
+class ZuqiuSpider(scrapy.Spider):
+    name = 'zuqiu'
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES":{
+            'hg3535.pipelines.Zuqiupipeline': 300,
+        }
+    }
+    def start_requests(self):
+
+        for y in range(1, 4):
+            for i in range(10):
+                url = 'http://hg3535z.com/odds2/d/getodds?sid=1&pt=' + str(y) + '&ubt=' + 'am' + '&pn=' + str(
+                    i) + '&sb=2&dc=null&pid=0'
+                yield scrapy.Request(url=url, callback=self.parse, meta={'pt': y})
+
+
+    def parse(self, response):
+        if response.text:
+            try:
+                datas = json.loads(response.text).get('n-ot', "").get('egs', "")
+            except:
+                datas = ""
+            pt = copy.copy(response.meta['pt'])
+            if datas:
+                for result in datas:
+                    new_results = result['es']
+                    for new_result in new_results:
+                        game_id = str(new_result['i'][16])
+                        if pt == 1:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid="+game_id+"iip=false&ubt=am&isp=false"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 2:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid="+game_id+"iip=false&ubt=am&isp=false"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+                        if pt == 3:
+                            url = "http://hg3535z.com/odds2/d/getamodds?eid="+game_id+"iip=false&ubt=am&isp=true"
+                            yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
+    def parse_each(self, response):
+        # 球队进球数 大小
+        try:
+            datas = json.loads(response.text)['eg']['es']
+            league_id = json.loads(response.text)['eg']['c']['k']
+            # 联赛名
+            league_name = json.loads(response.text)['eg']['c']['n']
+        except:
+            datas = ""
+            league_id = ""
+            # 联赛名
+            league_name = ""
+        try:
+            pt = response.meta['pt']
+        except:
+            pt = 0
+        if datas:
+            item = Zuqiu()
+            full_dict = {}
+            half_dict = {}
+            full_dict_rule = {}
+            half_dict_rule = {}
+            for data in datas:
+                try:
+                    new_data = data['pci']['ctid']
+                except:
+                    new_data = ""
+                if new_data == 0:
+                    # 比赛id
+                    game_id = str(data['k'])
+                    # 球队1
+                    team_home = data['i'][0]
+                    # 球队2
+                    team_guest = data['i'][1]
+                    # 数量(97>)
+                    number = data['i'][2]
+                    # 下半场
+                    half_way = data['i'][12]
+                    # 角球或者其他
+                    corner_ball = data['pci'].get('ctn', "")
+                    # 日期
+                    data_game = data['i'][4]
+                    # 开赛时间
+                    time_game = data['i'][5]
+
+# 让球------------------------------------------------------------------------------------------------------------------
+                    try:
+                        concedes = data['o']['ah']['v']
+                        new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 == 1]
+                        concede_homes = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 0]
+                        # concede_home_rule = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 0]
+                        concede_home_rule = []
+                        for i in range(len(concede_homes)):
+                            if i % 2 == 0:
+                                home_rule = str(concede_homes[i])
+                                if home_rule.startswith('+'):
+                                    n_home_rule = home_rule.replace('+', '-')
+                                    concede_home_rule.append(n_home_rule)
+                                elif home_rule.startswith('-'):
+                                    n_home_rule = home_rule.replace('-', '+')
+                                    concede_home_rule.append(n_home_rule)
+                                else:
+                                    concede_home_rule.append(home_rule)
+                                # concede_homes[i]
+                                # concede_home
+                        concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 1]
+
+                        concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 1]
+                        # concede_guest_rule
+                        # concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if
+                        #                       i % 2 == 0]
+                        # concede_guest
+                        concede_guest_rule = []
+                        for i in range(len(concede_guests)):
+                            if i % 2 == 0:
+                                guest_rule = str(concede_guests[i])
+                                if guest_rule.startswith('+'):
+                                    n_guest_rule = guest_rule.replace('+', '-')
+                                    concede_guest_rule.append(n_guest_rule)
+                                elif guest_rule.startswith('-'):
+                                    n_guest_rule = guest_rule.replace('-', '+')
+                                    concede_guest_rule.append(n_guest_rule)
+                                else:
+                                    concede_guest_rule.append(guest_rule)
+                        concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 1]
+                    except:
+                        concede_guest = ""
+                        concede_guest_rule = ""
+                        concede_home = ""
+                        concede_home_rule = ""
+
+# 上半场让球half_concede-------------------------------------------------------------------------------------------------
+                    try:
+                        half_concedes = data['o']['ah1st']['v']
+                        new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 == 1]
+                        new_half_concede_homes = [new_half_concedes[i] for i in range(len(new_half_concedes)) if
+                                                  i % 2 == 0]
+                        # half_concede_home_rule
+                        # half_concede_home_rule = [new_half_concede_homes[i] for i in
+                        #                           range(len(new_half_concede_homes)) if i % 2 == 0]
+
+                        half_concede_home_rule = []
+                        for i in range(len(new_half_concede_homes)):
+                            if i % 2 == 0:
+                                home_rule = str(new_half_concede_homes[i])
+                                if home_rule.startswith('+'):
+                                    n_home_rule = home_rule.replace('+', '-')
+                                    half_concede_home_rule.append(n_home_rule)
+                                if home_rule.startswith('-'):
+                                    n_home_rule = home_rule.replace('-', '+')
+                                    half_concede_home_rule.append(n_home_rule)
+                                else:
+                                    half_concede_home_rule.append(home_rule)
+                        # concede_home
+                        half_concede_home = [new_half_concede_homes[i] for i in
+                                             range(len(new_half_concede_homes)) if i % 2 == 1]
+                        half_concede_guests = [new_half_concedes[i] for i in range(len(new_half_concedes)) if
+                                               i % 2 == 1]
+                        # concede_guest_rule
+                        # half_concede_guest_rule = [half_concede_guests[i] for i in
+                        #                            range(len(half_concede_guests)) if i % 2 == 0]
+                        half_concede_guest_rule = []
+                        for i in range(len(half_concede_guests)):
+                            if i % 2 == 0:
+                                guest_rule = str(half_concede_guests[i])
+                                if guest_rule.startswith('+'):
+                                    n_guest_rule = guest_rule.replace('+', '-')
+                                    half_concede_guest_rule.append(n_guest_rule)
+                                if guest_rule.startswith('-'):
+                                    n_guest_rule = guest_rule.replace('-', '+')
+                                    half_concede_guest_rule.append(n_guest_rule)
+                                else:
+                                    half_concede_guest_rule.append(guest_rule)
+                        # concede_guest
+                        half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if
+                                              i % 2 == 1]
+                    except:
+                        half_concede_home_rule = ""
+                        half_concede_home = ""
+                        half_concede_guest_rule = ""
+                        half_concede_guest = ""
+
+# 全场大小size 进球大小---------------------------------------------------------------------------------------------------
+                    try:
+                        sizes = data['o']['ou']['v']
+                        new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 == 1]
+                        size_homes = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 0]
+                        # size_home_rule
+                        size_home_rule = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 0]
+                        # size_home
+                        size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 1]
+
+                        size_guests = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 1]
+                        # size_guest_rule
+                        size_guest_rule = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 0]
+                        # csize_guest
+                        size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 1]
+                    except:
+                        size_guest = ""
+                        size_guest_rule = ""
+                        size_home = ""
+                        size_home_rule = ""
+
+# 上半场大小 进球大小 half_size-------------------------------------------------------------------------------------------
+                    try:
+                        half_sizes = data['o']['ou1st']['v']
+                        new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 == 1]
+                        half_size_homes = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 0]
+                        # size_home_rule
+                        half_size_home_rule = [half_size_homes[i] for i in range(len(half_size_homes)) if
+                                               i % 2 == 0]
+                        # half_size_home 主队
+                        half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 1]
+                        half_size_guests = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 1]
+                        # half_size_guest_rule 客队
+                        half_size_guest_rule = [half_size_guests[i] for i in range(len(half_size_guests)) if
+                                                i % 2 == 0]
+                        # half_size_guest
+                        half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if
+                                           i % 2 == 1]
+                    except:
+                        half_size_guest = ""
+                        half_size_guest_rule = ""
+                        half_size_home = ""
+                        half_size_home_rule = ""
+
+# 全场总进球 total_goal--------------------------------------------------------------------------------------------------
+                    total_goal = {}
+                    try:
+                        total_goals = data['o']['tg']['v']
+                        new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 == 1]
+                        total_goal["total_goal_zero"] = float(new_total_goals[0]) - 1
+                        total_goal["total_goal_two"] = float(new_total_goals[1]) - 1
+                        total_goal["total_goal_four"] = float(new_total_goals[2]) - 1
+                        total_goal["total_goal_seven"] = float(new_total_goals[3]) - 1
+                    except:
+                        total_goal["total_goal_zero"] = ""
+                        total_goal["total_goal_two"] = ""
+                        total_goal["total_goal_four"] = ""
+                        total_goal["total_goal_seven"] = ""
+
+# 总进球上半场 half_total_goal-------------------------------------------------------------------------------------------
+                    try:
+                        half_total_goals = data['o']['tg1st']['v']
+                        new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 == 1]
+                        total_goal["half_total_goal_zero"] = float(new_half_total_goals[0]) - 1
+                        total_goal["half_total_goal_one"] = float(new_half_total_goals[1]) - 1
+                        total_goal["half_total_goal_two"] = float(new_half_total_goals[2]) - 1
+                        total_goal["half_total_goal_three"] = float(new_half_total_goals[3]) - 1
+                    except:
+                        total_goal["half_total_goal_zero"] = ""
+                        total_goal["half_total_goal_one"] = ""
+                        total_goal["half_total_goal_two"] = ""
+                        total_goal["half_total_goal_three"] = ""
+
+# 早盘 半场/全场---------------------------------------------------------------------------------------------------------
+                    half_full = {}
+                    new_lists = ["half_full_home_home", "half_full_home_dogfall", "half_full_home_guest",
+                                 "half_full_dogfall_home", "half_full_dogfall_dogfall", "half_full_dogfall_guest",
+                                 "half_full_guest_home", "half_full_guest_dogfall", "half_full_guest_guest"]
+                    # 早盘 半场/全场
+                    try:
+                        half_fulls = data['o']['hf']['v']
+                        new_half_fulls = [half_fulls[i] for i in range(len(half_fulls)) if i % 2 == 1]
+                        for index, value in enumerate(new_lists):
+                            half_full[value] = float(new_half_fulls[index]) - 1
+                    except:
+                        for index, value in enumerate(new_lists):
+                            half_full[value] = ""
+
+# 早盘 最先/最后进球 最先进球 ---------------------------------------------------------------------------------------------
+                    first_last_ball = {}
+                    try:
+                        first_balls = data['o']['ttslast']['v']
+                        first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 == 1]
+                        first_last_ball['first_ball_home'] = float(first_ball[0]) - 1
+                        first_last_ball['first_ball_guest'] = float(first_ball[1]) - 1
+                    except:
+                        pass
+
+                    # 早盘 最先/最后进球 最后进球
+
+                    try:
+                        last_balls = data['o']['tts1st']['v']
+                        last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 == 1]
+                        first_last_ball['last_ball_home'] = float(last_ball[0]) - 1
+                        first_last_ball['last_ball_guest'] = float(last_ball[1]) - 1
+                        first_last_ball['not_ball'] = float(last_ball[2]) - 1
+                    except:
+                        pass
+
+# 全场独赢capot ---------------------------------------------------------------------------------------------------------
+
+                    try:
+                        capots = data['o']['1x2']['v']
+                        new_capots = [capots[i] for i in range(len(capots)) if i % 2 == 1]
+                        capot_home = float(new_capots[0]) - 1
+                        capot_guest = float(new_capots[1]) - 1
+                        capot_dogfall = float(new_capots[2]) - 1
+                    except:
+                        capot_home = ""
+                        capot_guest = ""
+                        capot_dogfall = ""
+
+                    # 上半场独赢capot
+                    try:
+                        half_capots = data['o']['1x21st']['v']
+                        new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
+                        half_capot_home = float(new_half_capots[0]) - 1
+                        half_capot_guest = float(new_half_capots[1]) - 1
+                        half_capot_dogfall = float(new_half_capots[2]) - 1
+                    except:
+                        half_capot_home = ""
+                        half_capot_guest = ""
+                        half_capot_dogfall = ""
+
+# 全场入球:单/双 odd_even------------------------------------------------------------------------------------------------
+                    try:
+                        odd_evens = data['o']['oe']['v']
+                        new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 == 1]
+                        odd_even_odd = new_odd_evens[0]
+                        odd_even_even = new_odd_evens[1]
+                    except:
+                        odd_even_odd = ""
+                        odd_even_even = ""
+                    # 半场入球:单/双 half_odd_even
+                    try:
+                        half_odd_evens = data['o']['oe1st']['v']
+                        new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 == 1]
+                        half_odd_even_odd = new_half_odd_evens[0]
+                        half_odd_even_even = new_half_odd_evens[1]
+                    except:
+                        half_odd_even_odd = ""
+                        half_odd_even_even = ""
+
+                    bodan_data = {}
+# 波胆------------------------------------------------------------------------------------------------------------------
+                    try:
+                        bodans = data['o']['cs']['v']
+                        one_list = ["bodanhome_one_zero", "bodanhome_two_zero", "bodanhome_two_one",
+                                    "bodanhome_three_zero", "bodanhome_three_one", "bodanhome_three_two",
+                                    "bodanhome_four_zero", "bodanhome_four_one", "bodanhome_four_two",
+                                    "bodanhome_four_three"]
+                        two_list = ["bodanguest_one_zero", "bodanguest_two_zero", "bodanguest_two_one",
+                                    "bodanguest_three_zero", "bodanguest_three_one", "bodanguest_three_two",
+                                    "bodanguest_four_zero", "bodanguest_four_one", "bodanguest_four_two",
+                                    "bodanguest_four_three"]
+                        three_list = ["bodandogfall_zero_zero", "bodandogfall_one_one", "bodandogfall_two_two",
+                                      "bodandogfall_three_three", "bodandogfall_four_four"]
+                        new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 == 1]
+                        new_bodan = new_bodans[0:20]
+                        # 主队bodan_home
+                        bodan_home = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 0]
+                        for index, t in enumerate(one_list):
+                            bodan_data[t] = float(bodan_home[index]) - 1
+                        # 客队bodan_guest
+                        bodan_guest = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 1]
+                        for y, z in enumerate(two_list):
+                            bodan_data[z] = float(bodan_guest[y]) - 1
+                        bodan_dogfall = new_bodans[-7:-2]
+                        for a, b in enumerate(three_list):
+                            bodan_data[b] = float(bodan_dogfall[a]) - 1
+                        # 其他bodan_other
+                        bodan_data['bodanother'] = float(new_bodans[-1]) - 1
+                    except:
+                        pass
+
+                    try:
+                        half_bodans = data['o']['cs1st']['v']
+                        new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 == 1]
+                        new_one = ["halfbodanhome_one_zero", "halfbodanhome_two_zero", "halfbodanhome_two_one",
+                                   "halfbodanhome_three_zero", "halfbodanhome_three_one", "halfbodanhome_three_two"]
+                        new_two = ["halfbodanguest_one_zero", "halfbodanguest_two_zero", "halfbodanguest_two_one",
+                                   "halfbodanguest_three_zero", "halfbodanguest_three_one", "halfbodanguest_three_two"]
+                        new_three = ["halfbodandogfall_zero_zero", "halfbodandogfall_one_one",
+                                     "halfbodandogfall_two_two",
+                                     "halfbodandogfall_three_three"]
+                        halfbodan = new_half_bodans[0:12]
+                        half_bodan_home = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 0]
+                        # 队1
+                        for index, t in enumerate(new_one):
+                            bodan_data[t] = float(half_bodan_home[index]) - 1
+                        # 队2
+                        half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 1]
+                        for y, z in enumerate(new_two):
+                            bodan_data[z] = float(half_bodan_guest[y]) - 1
+                        # 和/平
+                        half_bodan_dogfall = new_half_bodans[-6:-2]
+                        for a, b in enumerate(new_three):
+                            bodan_data[b] = float(half_bodan_dogfall[a]) - 1
+                        # 其他
+                        bodan_data['halfbodanother'] = float(new_half_bodans[-1]) - 1
+                    except:
+                        pass
+                if new_data == 12:
+                    try:
+                        home_data = data['o']['ou']['v']
+
+                        # 球队进球 大条件
+                        home_size_big_rule = home_data[1]
+                        full_dict_rule['home_size_big'] = home_size_big_rule
+
+                        # 球队进球大赔率
+                        home_size_big = home_data[5]
+                        full_dict['home_size_big'] = home_size_big
+
+                        # 球队进球小条件
+                        home_size_small_rule = home_data[3]
+                        full_dict_rule['home_size_small'] = home_size_small_rule
+
+                        # 球队进球小赔率
+                        home_size_small = home_data[7]
+                        full_dict['home_size_small'] = home_size_small
+                    except:
+                        full_dict['home_size_small'] = ""
+                        full_dict_rule['home_size_small'] = ""
+
+                        full_dict['home_size_big'] = ""
+                        full_dict_rule['home_size_big'] = ""
+                    try:
+                        half_home_data = data['o']['ou1st']['v']
+
+                        half_home_size_big_rule = half_home_data[1]
+                        half_dict_rule['half_home_size_big'] = half_home_size_big_rule
+
+                        half_home_size_big = half_home_data[5]
+                        half_dict['half_home_size_big'] = half_home_size_big
+
+                        half_home_size_small_rule = half_home_data[3]
+                        half_dict_rule['half_home_size_small'] = half_home_size_small_rule
+
+                        half_home_size_small = half_home_data[7]
+                        half_dict['half_home_size_small'] = half_home_size_small
+
+                    except:
+                        half_dict_rule['half_home_size_big'] = ""
+                        half_dict['half_home_size_big'] = ""
+
+                        half_dict_rule['half_home_size_small'] = ""
+                        half_dict['half_home_size_small'] = ""
+
+                if new_data == 13:
+                    try:
+                        guest_data = data['o']['ou']['v']
+
+                        guest_size_big_rule = guest_data[1]
+                        full_dict_rule['guest_size_big'] = guest_size_big_rule
+
+                        guest_size_big = guest_data[5]
+                        full_dict['guest_size_big'] = guest_size_big
+
+                        guest_size_small_rule = guest_data[3]
+                        full_dict_rule['guest_size_small'] = guest_size_small_rule
+
+                        guest_size_small = guest_data[7]
+                        full_dict['guest_size_small'] = guest_size_small
+                    except:
+                        full_dict_rule['guest_size_big'] = ""
+                        full_dict['guest_size_big'] = ""
+
+                        full_dict_rule['guest_size_small'] = ""
+                        full_dict['guest_size_small'] = ''
+                    try:
+                        half_guest_data = data['o']['ou1st']['v']
+
+                        half_guest_size_big_rule = half_guest_data[1]
+                        half_dict_rule['half_guest_size_big'] = half_guest_size_big_rule
+
+                        half_guest_size_big = half_guest_data[5]
+                        half_dict['half_guest_size_big'] = half_guest_size_big
+
+                        half_guest_size_small_rule = half_guest_data[3]
+                        half_dict_rule['half_guest_size_small'] = half_guest_size_small_rule
+
+                        half_guest_size_small = half_guest_data[7]
+                        half_dict['half_guest_size_small'] = half_guest_size_small
+                    except:
+                        half_dict_rule['half_guest_size_big'] = ""
+                        half_dict['half_guest_size_big'] = ""
+
+                        half_dict_rule['half_guest_size_small'] = ""
+                        half_dict['half_guest_size_small'] = ""
+
+            item['league_id'] = league_id
+            item['league_name'] = league_name
+            item['pt'] = pt
+            item['game_id'] = game_id
+            item['team_home'] = team_home
+            item['team_guest'] = team_guest
+            item['number'] = number
+            item['data_game'] = data_game
+            item['time_game'] = time_game
+            item['corner_ball'] = corner_ball
+            # 波胆
+            item['bodan_data'] = bodan_data
+            # 早盘入球数单双
+            item["odd_even_odd"] = odd_even_odd
+            item["odd_even_even"] = odd_even_even
+            item["half_odd_even_odd"] = half_odd_even_odd
+            item["half_odd_even_even"] = half_odd_even_even
+
+            item['total_goal'] = total_goal
+
+            item["half_capot_home"] = half_capot_home
+            item["half_capot_guest"] = half_capot_guest
+            item["half_capot_dogfall"] = half_capot_dogfall
+
+            item["capot_home"] = capot_home
+            item["capot_guest"] = capot_guest
+            item["capot_dogfall"] = capot_dogfall
+
+            item["first_last_ball"] = first_last_ball
+
+            item["half_full"] = half_full
+
+            item["half_size_guest"] = half_size_guest
+            item["half_size_guest_rule"] = half_size_guest_rule
+            item["half_size_home"] = half_size_home
+            item["half_size_home_rule"] = half_size_home_rule
+            # 全场大小
+            item["size_guest"] = size_guest
+            item["size_guest_rule"] = size_guest_rule
+            item["size_home"] = size_home
+            item["size_home_rule"] = size_home_rule
+            # 上半场让球
+            item["half_concede_home_rule"] = half_concede_home_rule
+            item["half_concede_home"] = half_concede_home
+            item["half_concede_guest_rule"] = half_concede_guest_rule
+            item["half_concede_guest"] = half_concede_guest
+            # 全场让球
+            item["concede_guest"] = concede_guest
+            item["concede_guest_rule"] = concede_guest_rule
+            item["concede_home"] = concede_home
+            item["concede_home_rule"] = concede_home_rule
+
+            item['full_data'] = full_dict
+            item['half_data'] = half_dict
+            item['full_data_rule'] = full_dict_rule
+            item['half_data_rule'] = half_dict_rule
+            yield item
+
+
+
+

+ 0 - 0
new_hg3535s/pip


+ 68 - 0
new_hg3535s/requirements.txt

@@ -0,0 +1,68 @@
+aiopg==0.16.0
+asn1crypto==0.24.0
+asyncio==3.4.3
+attrs==19.1.0
+Automat==0.7.0
+certifi==2019.3.9
+cffi==1.12.2
+chardet==3.0.4
+Click==7.0
+constantly==15.1.0
+cryptography==2.6.1
+cssselect==1.0.3
+defusedxml==0.5.0
+et-xmlfile==1.0.1
+Flask==1.0.2
+Flask-Login==0.4.1
+hyperlink==18.0.0
+idna==2.8
+incremental==17.5.0
+itsdangerous==1.1.0
+jdcal==1.4
+Jinja2==2.10
+jmespath==0.9.4
+jsmin==2.2.2
+lxml==4.3.2
+MarkupSafe==1.1.1
+numpy==1.16.2
+openpyxl==2.6.1
+pandas==0.24.2
+parsel==1.5.1
+peewee==2.8.0
+peewee-async==0.5.8
+psycopg2==2.7.7
+psycopg2-binary==2.8
+pyasn1==0.4.5
+pyasn1-modules==0.2.4
+pycparser==2.19
+pycurl==7.43.0.2
+PyDispatcher==2.0.5
+PyHamcrest==1.9.0
+PyMySQL==0.9.3
+pyOpenSSL==19.0.0
+pypiwin32==223
+pyquery==1.4.0
+pyspider==0.3.10
+python-dateutil==2.8.0
+pytz==2018.9
+pywin32==224
+PyYAML==3.13
+queuelib==1.5.0
+requests==2.21.0
+Scrapy==1.6.0
+scrapy-splash==0.7.2
+scrapyd==1.2.0
+scrapyd-client==1.1.0
+selenium==3.141.0
+service-identity==18.1.0
+six==1.12.0
+tblib==1.3.2
+tornado==4.5.3
+Twisted==18.9.0
+u-msgpack-python==2.5.1
+urllib3==1.24.1
+w3lib==1.20.0
+Werkzeug==0.14.1
+WsgiDAV==2.4.1
+xpinyin==0.5.6
+zope.interface==4.6.0

+ 0 - 0
new_hg3535s/scrapy-magicfields)


+ 11 - 0
new_hg3535s/scrapy.cfg

@@ -0,0 +1,11 @@
+# Automatically created by: scrapy startproject
+#
+# For more information about the [deploy] section see:
+# https://scrapyd.readthedocs.io/en/latest/deploy.html
+
+[settings]
+default = hg3535.settings
+
+[deploy:locals]
+url = http://localhost:6800/
+project = hg3535