Your Name 6 anni fa
parent
commit
a9b56084d5
72 ha cambiato i file con 0 aggiunte e 12336 eliminazioni
  1. 0 0
      pip
  2. 0 0
      scrapy-magicfields)
  3. 0 23
      scrapy_yzd/.idea/inspectionProfiles/Project_Default.xml
  4. 0 7
      scrapy_yzd/.idea/inspectionProfiles/profiles_settings.xml
  5. 0 72
      scrapy_yzd/.idea/markdown-navigator.xml
  6. 0 3
      scrapy_yzd/.idea/markdown-navigator/profiles_settings.xml
  7. 0 4
      scrapy_yzd/.idea/misc.xml
  8. 0 8
      scrapy_yzd/.idea/modules.xml
  9. 0 11
      scrapy_yzd/.idea/scrapy_yzd.iml
  10. 0 6
      scrapy_yzd/.idea/vcs.xml
  11. 0 1593
      scrapy_yzd/.idea/workspace.xml
  12. BIN
      scrapy_yzd/.scrapy/deltafetch/ball_status.db
  13. BIN
      scrapy_yzd/.scrapy/deltafetch/bangqiu.db
  14. BIN
      scrapy_yzd/.scrapy/deltafetch/hg3535.db
  15. BIN
      scrapy_yzd/.scrapy/deltafetch/hg3535_supplement.db
  16. BIN
      scrapy_yzd/.scrapy/deltafetch/lanqiu.db
  17. BIN
      scrapy_yzd/.scrapy/deltafetch/tennis.db
  18. 0 9
      scrapy_yzd/README.md
  19. BIN
      scrapy_yzd/__pycache__/models.cpython-36.pyc
  20. 0 25
      scrapy_yzd/main.py
  21. 0 0
      scrapy_yzd/model.py
  22. 0 193
      scrapy_yzd/models.py
  23. 0 69
      scrapy_yzd/requirements.txt
  24. 0 11
      scrapy_yzd/scrapy.cfg
  25. 0 0
      scrapy_yzd/scrapy_yzd/__init__.py
  26. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-35.pyc
  27. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-36.pyc
  28. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-35.pyc
  29. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-36.pyc
  30. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/pipelines.cpython-36.pyc
  31. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-35.pyc
  32. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-36.pyc
  33. 0 349
      scrapy_yzd/scrapy_yzd/autoproxy.py
  34. 0 374
      scrapy_yzd/scrapy_yzd/items.py
  35. 0 53
      scrapy_yzd/scrapy_yzd/middlewares.py
  36. 0 3569
      scrapy_yzd/scrapy_yzd/pipelines.py
  37. 0 120
      scrapy_yzd/scrapy_yzd/settings.py
  38. 0 4
      scrapy_yzd/scrapy_yzd/spiders/__init__.py
  39. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-35.pyc
  40. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-36.pyc
  41. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bangqiu.cpython-36.pyc
  42. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bq_status.cpython-36.pyc
  43. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bq_status_up.cpython-36.pyc
  44. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_lanqiu.cpython-36.pyc
  45. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_lq_status.cpython-36.pyc
  46. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_lq_status_up.cpython-36.pyc
  47. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_supplement.cpython-36.pyc
  48. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_wangqiu.cpython-36.pyc
  49. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_wq_status.cpython-36.pyc
  50. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_wq_status_up.cpython-36.pyc
  51. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_zq_status.cpython-36.pyc
  52. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_zq_status_up.cpython-36.pyc
  53. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_zuqiu.cpython-36.pyc
  54. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/test.cpython-36.pyc
  55. 0 32
      scrapy_yzd/scrapy_yzd/spiders/hg3535_bangqiu.py
  56. 0 231
      scrapy_yzd/scrapy_yzd/spiders/hg3535_bq_status.py
  57. 0 322
      scrapy_yzd/scrapy_yzd/spiders/hg3535_bq_status_up.py
  58. 0 820
      scrapy_yzd/scrapy_yzd/spiders/hg3535_lanqiu.py
  59. 0 231
      scrapy_yzd/scrapy_yzd/spiders/hg3535_lq_status.py
  60. 0 321
      scrapy_yzd/scrapy_yzd/spiders/hg3535_lq_status_up.py
  61. 0 207
      scrapy_yzd/scrapy_yzd/spiders/hg3535_supplement.py
  62. 0 373
      scrapy_yzd/scrapy_yzd/spiders/hg3535_wangqiu.py
  63. 0 231
      scrapy_yzd/scrapy_yzd/spiders/hg3535_wq_status.py
  64. 0 321
      scrapy_yzd/scrapy_yzd/spiders/hg3535_wq_status_up.py
  65. 0 231
      scrapy_yzd/scrapy_yzd/spiders/hg3535_zq_status.py
  66. 0 325
      scrapy_yzd/scrapy_yzd/spiders/hg3535_zq_status_up.py
  67. 0 833
      scrapy_yzd/scrapy_yzd/spiders/hg3535_zuqiu.py
  68. 0 8
      scrapy_yzd/scrapy_yzd/spiders/test.py
  69. 0 690
      scrapy_yzd/scrapy_yzd/test1.py
  70. 0 644
      scrapy_yzd/scrapy_yzd/test3.py
  71. 0 0
      scrapy_yzd/test.json
  72. 0 13
      scrapy_yzd/test4.py

+ 0 - 0
pip


+ 0 - 0
scrapy-magicfields)


+ 0 - 23
scrapy_yzd/.idea/inspectionProfiles/Project_Default.xml

@@ -1,23 +0,0 @@
-<component name="InspectionProjectProfileManager">
-  <profile version="1.0">
-    <option name="myName" value="Project Default" />
-    <option name="myLocal" value="true" />
-    <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
-      <option name="ignoredPackages">
-        <value>
-          <list size="1">
-            <item index="0" class="java.lang.String" itemvalue="certifi" />
-          </list>
-        </value>
-      </option>
-    </inspection_tool>
-    <inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
-      <option name="ignoredErrors">
-        <list>
-          <option value="E221" />
-          <option value="E222" />
-        </list>
-      </option>
-    </inspection_tool>
-  </profile>
-</component>

+ 0 - 7
scrapy_yzd/.idea/inspectionProfiles/profiles_settings.xml

@@ -1,7 +0,0 @@
-<component name="InspectionProjectProfileManager">
-  <settings>
-    <option name="PROJECT_PROFILE" value="Project Default" />
-    <option name="USE_PROJECT_PROFILE" value="true" />
-    <version value="1.0" />
-  </settings>
-</component>

+ 0 - 72
scrapy_yzd/.idea/markdown-navigator.xml

@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="MarkdownProjectSettings">
-    <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true" openRemoteLinks="true">
-      <PanelProvider>
-        <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
-      </PanelProvider>
-    </PreviewSettings>
-    <ParserSettings gitHubSyntaxChange="false">
-      <PegdownExtensions>
-        <option name="ABBREVIATIONS" value="false" />
-        <option name="ANCHORLINKS" value="true" />
-        <option name="ASIDE" value="false" />
-        <option name="ATXHEADERSPACE" value="true" />
-        <option name="AUTOLINKS" value="true" />
-        <option name="DEFINITIONS" value="false" />
-        <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
-        <option name="FENCED_CODE_BLOCKS" value="true" />
-        <option name="FOOTNOTES" value="false" />
-        <option name="HARDWRAPS" value="false" />
-        <option name="HTML_DEEP_PARSER" value="false" />
-        <option name="INSERTED" value="false" />
-        <option name="QUOTES" value="false" />
-        <option name="RELAXEDHRULES" value="true" />
-        <option name="SMARTS" value="false" />
-        <option name="STRIKETHROUGH" value="true" />
-        <option name="SUBSCRIPT" value="false" />
-        <option name="SUPERSCRIPT" value="false" />
-        <option name="SUPPRESS_HTML_BLOCKS" value="false" />
-        <option name="SUPPRESS_INLINE_HTML" value="false" />
-        <option name="TABLES" value="true" />
-        <option name="TASKLISTITEMS" value="true" />
-        <option name="TOC" value="false" />
-        <option name="WIKILINKS" value="true" />
-      </PegdownExtensions>
-      <ParserOptions>
-        <option name="COMMONMARK_LISTS" value="true" />
-        <option name="DUMMY" value="false" />
-        <option name="EMOJI_SHORTCUTS" value="true" />
-        <option name="FLEXMARK_FRONT_MATTER" value="false" />
-        <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
-        <option name="GFM_TABLE_RENDERING" value="true" />
-        <option name="GITBOOK_URL_ENCODING" value="false" />
-        <option name="GITHUB_EMOJI_URL" value="false" />
-        <option name="GITHUB_LISTS" value="false" />
-        <option name="GITHUB_WIKI_LINKS" value="true" />
-        <option name="JEKYLL_FRONT_MATTER" value="false" />
-        <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
-      </ParserOptions>
-    </ParserSettings>
-    <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true" embedImages="false" embedHttpImages="false">
-      <GeneratorProvider>
-        <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
-      </GeneratorProvider>
-      <headerTop />
-      <headerBottom />
-      <bodyTop />
-      <bodyBottom />
-    </HtmlSettings>
-    <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
-      <StylesheetProvider>
-        <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
-      </StylesheetProvider>
-      <ScriptProviders />
-      <cssText />
-    </CssSettings>
-    <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" />
-    <LinkMapSettings>
-      <textMaps />
-    </LinkMapSettings>
-  </component>
-</project>

+ 0 - 3
scrapy_yzd/.idea/markdown-navigator/profiles_settings.xml

@@ -1,3 +0,0 @@
-<component name="MarkdownNavigator.ProfileManager">
-  <settings default="" pdf-export="" />
-</component>

+ 0 - 4
scrapy_yzd/.idea/misc.xml

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.2 (~/anaconda3/envs/crawl_price/bin/python)" project-jdk-type="Python SDK" />
-</project>

+ 0 - 8
scrapy_yzd/.idea/modules.xml

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

+ 0 - 11
scrapy_yzd/.idea/scrapy_yzd.iml

@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
-  <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$" />
-    <orderEntry type="jdk" jdkName="Python 3.6.2 (~/anaconda3/envs/crawl_price/bin/python)" jdkType="Python SDK" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-  <component name="TestRunnerService">
-    <option name="PROJECT_TEST_RUNNER" value="Unittests" />
-  </component>
-</module>

+ 0 - 6
scrapy_yzd/.idea/vcs.xml

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

+ 0 - 1593
scrapy_yzd/.idea/workspace.xml

@@ -1,1593 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ChangeListManager">
-    <list default="true" id="10c8f782-159c-419a-b657-aa18f8ed099d" name="Default" comment="" />
-    <ignored path="scrapy_yzd.iws" />
-    <ignored path=".idea/workspace.xml" />
-    <ignored path=".idea/dataSources.local.xml" />
-    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
-    <option name="TRACKING_ENABLED" 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/scrapy_yzd$test.coverage" NAME="test Coverage Results" MODIFIED="1553852725802" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd/spiders" />
-    <SUITE FILE_PATH="coverage/scrapy_yzd$test3.coverage" NAME="test3 Coverage Results" MODIFIED="1556261257807" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd" />
-    <SUITE FILE_PATH="coverage/scrapy_yzd$test1.coverage" NAME="test1 Coverage Results" MODIFIED="1556501488007" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd" />
-    <SUITE FILE_PATH="coverage/scrapy_yzd$test4.coverage" NAME="test4 Coverage Results" MODIFIED="1556255778210" 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/scrapy_yzd$hg3535.coverage" NAME="hg3535 Coverage Results" MODIFIED="1553739427011" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd/spiders" />
-    <SUITE FILE_PATH="coverage/scrapy_yzd$settings.coverage" NAME="settings Coverage Results" MODIFIED="1555635275282" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd" />
-    <SUITE FILE_PATH="coverage/scrapy_yzd$pipelines.coverage" NAME="pipelines Coverage Results" MODIFIED="1557119162994" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd" />
-    <SUITE FILE_PATH="coverage/scrapy_yzd$autoproxy.coverage" NAME="autoproxy Coverage Results" MODIFIED="1557112463797" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd" />
-    <SUITE FILE_PATH="coverage/scrapy_yzd$main.coverage" NAME="main Coverage Results" MODIFIED="1557135969571" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
-  </component>
-  <component name="CreatePatchCommitExecutor">
-    <option name="PATCH_PATH" value="" />
-  </component>
-  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
-  <component name="FavoritesManager">
-    <favorites_list name="scrapy_yzd" />
-  </component>
-  <component name="FileEditorManager">
-    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file leaf-file-name="main.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/main.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="189">
-              <caret line="12" column="46" selection-start-line="12" selection-start-column="46" selection-end-line="12" selection-end-column="46" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="pipelines.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/pipelines.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="24097">
-              <caret line="3211" column="15" selection-start-line="3211" selection-start-column="15" selection-end-line="3211" selection-end-column="15" />
-              <folding>
-                <element signature="e#275#312#0" expanded="true" />
-                <element signature="e#79131#79159#0" expanded="false" />
-                <element signature="e#170505#170541#0" expanded="false" />
-                <element signature="e#171886#177049#0" expanded="false" />
-                <element signature="e#178364#178398#0" expanded="false" />
-                <element signature="e#243234#245792#0" expanded="false" />
-                <element signature="e#245837#248393#0" expanded="false" />
-                <element signature="e#248438#250995#0" expanded="false" />
-                <marker date="1557135609211" expanded="true" signature="60256:60486" ph="insert into st_zq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="60877:61053" ph="insert into st_zq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="61551:61781" ph="insert into st_zq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="62177:62353" ph="insert into st_zq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="174497:174756" ph="insert into st_zq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="174497:174769" ph="insert into st_zq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="175091:175293" ph="insert into st_zq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="175912:176171" ph="insert into st_zq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="175912:176184" ph="insert into st_zq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="176505:176707" ph="insert into st_zq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="180565:180816" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="180565:180830" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="181161:181356" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="181590:182020" ph="insert into st_lq_result... " />
-                <marker date="1557135609211" expanded="true" signature="182335:182602" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="183171:183420" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="183171:183434" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="183717:183912" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="184118:184548" ph="insert into st_lq_result... " />
-                <marker date="1557135609211" expanded="true" signature="184863:185130" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="185703:185952" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="185703:185966" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="186252:186446" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="186656:187086" ph="insert into st_lq_result... " />
-                <marker date="1557135609211" expanded="true" signature="187401:187668" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="188244:188493" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="188244:188506" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="188772:188966" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="189154:189584" ph="insert into st_lq_result... " />
-                <marker date="1557135609211" expanded="true" signature="189887:190154" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="190731:190980" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="190731:190993" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="191260:191454" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="191643:192073" ph="insert into st_lq_result... " />
-                <marker date="1557135609211" expanded="true" signature="192380:192647" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="193146:193382" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="193146:193396" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="193644:193823" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="193993:194423" ph="insert into st_lq_result... " />
-                <marker date="1557135609211" expanded="true" signature="194726:194993" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="195560:195809" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="195560:195822" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="196110:196304" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="196512:196942" ph="insert into st_lq_result... " />
-                <marker date="1557135609211" expanded="true" signature="197257:197524" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="197752:198001" ph="insert into st_lq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="197752:198018" ph="insert into st_lq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="201864:202114" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="201864:202127" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="202442:202637" ph="insert into st_wq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="202902:203441" ph="insert into st_wq_result... " />
-                <marker date="1557135609211" expanded="true" signature="203738:204168" ph="insert into st_lq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="204691:204928" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="204691:204941" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="205209:205389" ph="insert into st_wq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="205579:206118" ph="insert into st_wq_result... " />
-                <marker date="1557135609211" expanded="true" signature="206683:206933" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="206683:206947" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="207261:207456" ph="insert into st_wq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="207691:208230" ph="insert into st_wq_result... " />
-                <marker date="1557135609211" expanded="true" signature="208805:209055" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="208805:209068" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="209392:209587" ph="insert into st_wq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="209834:210373" ph="insert into st_wq_result... " />
-                <marker date="1557135609211" expanded="true" signature="210942:211192" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="210942:211205" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="211523:211718" ph="insert into st_wq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="211938:212477" ph="insert into st_wq_result... " />
-                <marker date="1557135609211" expanded="true" signature="212766:213000" ph="insert into st_wq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="216250:216481" ph="insert into st_wq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="216790:216966" ph="insert into st_wq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="217483:217714" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="217988:218164" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="218643:218874" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="219152:219328" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="219804:220035" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="220296:220472" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="220939:221170" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="221432:221608" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="222007:222224" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="222466:222627" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="223078:223309" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="223587:223763" ph="insert into st_lq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="223979:224198" ph="insert into st_lq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="224897:225190" ph="insert into st_bq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="225596:225792" ph="insert into st_bq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="226057:226497" ph="insert into st_bq_result... " />
-                <marker date="1557135609211" expanded="true" signature="231220:231500" ph="insert into st_bq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="231824:232004" ph="insert into st_bq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="232201:232641" ph="insert into st_bq_result... " />
-                <marker date="1557135609211" expanded="true" signature="232631:232641" ph="insert into st_bq_result... " />
-                <marker date="1557135609211" expanded="true" signature="232927:233101" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="232927:233156" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="232927:233157" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="232927:233165" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="233660:233940" ph="insert into st_bq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="234274:234454" ph="insert into st_bq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="234666:235106" ph="insert into st_bq_result... " />
-                <marker date="1557135609211" expanded="true" signature="235398:235636" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="236107:236370" ph="insert into st_bq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="236685:236880" ph="insert into st_bq_odds_record... " />
-                <marker date="1557135609211" expanded="true" signature="237145:237585" ph="insert into st_bq_result... " />
-                <marker date="1557135609211" expanded="true" signature="237876:238292" ph="insert into st_bq_result_record... " />
-                <marker date="1557135609211" expanded="true" signature="238531:238811" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="238989:239339" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="239559:239909" ph="insert into st_bq_competition... " />
-                <marker date="1557135609211" expanded="true" signature="242000:242160" ph="insert into st_ball_status2... " />
-                <marker date="1557135609211" expanded="true" signature="242189:242297" ph="insert into st_lq_odds... " />
-                <marker date="1557135609211" expanded="true" signature="242427:242476" ph="update st_zq... " />
-                <marker date="1557135609211" expanded="true" signature="242521:242577" ph="update st_zq... " />
-                <marker date="1557135609211" expanded="true" signature="242622:242676" ph="update st_zq... " />
-                <marker date="1557135609211" expanded="true" signature="245008:245168" ph="insert into st_ball_status... " />
-                <marker date="1557135609211" expanded="true" signature="247609:247769" ph="insert into st_ball_status... " />
-                <marker date="1557135609211" expanded="true" signature="250211:250371" ph="insert into st_ball_status... " />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="model.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/model.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="0">
-              <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="hg3535_zuqiu.py" pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zuqiu.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="21">
-              <caret line="71" column="25" selection-start-line="71" selection-start-column="25" selection-end-line="71" selection-end-column="25" />
-              <folding>
-                <element signature="e#42#57#0" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="hg3535_bq_status_up.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status_up.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="178">
-              <caret line="196" column="42" selection-start-line="196" selection-start-column="42" selection-end-line="196" selection-end-column="42" />
-              <folding>
-                <element signature="e#25#40#0" expanded="true" />
-                <marker date="1557119962650" expanded="true" signature="5966:6022" ph="select match... st_ball_status" />
-                <marker date="1557119962650" expanded="true" signature="9345:9394" ph="update st_bq... " />
-                <marker date="1557119962650" expanded="true" signature="9457:9513" ph="update st_bq... " />
-                <marker date="1557119962650" expanded="true" signature="9576:9630" ph="update st_bq... " />
-                <marker date="1557119962650" expanded="true" signature="9834:9904" ph="update st_ba... " />
-                <marker date="1557119962650" expanded="true" signature="9961:10122" ph="insert into comendnotice... " />
-                <marker date="1557119962650" expanded="true" signature="10859:10929" ph="update st_ba... " />
-                <marker date="1557119962650" expanded="true" signature="10978:11139" ph="insert into comendnotice... " />
-                <marker date="1557119962650" expanded="true" signature="11250:11299" ph="update st_bq... " />
-                <marker date="1557119962650" expanded="true" signature="11354:11410" ph="update st_bq... " />
-                <marker date="1557119962650" expanded="true" signature="11465:11519" ph="update st_bq... " />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="hg3535_zq_status_up.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status_up.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="217">
-              <caret line="273" column="54" selection-start-line="273" selection-start-column="54" selection-end-line="273" selection-end-column="54" />
-              <folding>
-                <element signature="e#25#40#0" expanded="true" />
-                <marker date="1557120101540" expanded="true" signature="6202:6237" ph="select match... st_ball_status2" />
-                <marker date="1557120101540" expanded="true" signature="6202:6258" ph="select match... st_ball_status" />
-                <marker date="1557120101540" expanded="true" signature="8702:8772" ph="update st_ba... " />
-                <marker date="1557120101540" expanded="true" signature="8829:8966" ph="insert into comendnotice... " />
-                <marker date="1557120101540" expanded="true" signature="9719:9789" ph="update st_ba... " />
-                <marker date="1557120101540" expanded="true" signature="9846:9983" ph="insert into comendnotice... " />
-                <marker date="1557120101540" expanded="true" signature="10028:10077" ph="update st_zq... " />
-                <marker date="1557120101540" expanded="true" signature="10028:10079" ph="update st_zq... " />
-                <marker date="1557120101540" expanded="true" signature="10140:10196" ph="update st_zq... " />
-                <marker date="1557120101540" expanded="true" signature="10259:10313" ph="update st_zq... " />
-                <marker date="1557120101540" expanded="true" signature="11067:11137" ph="update st_ba... " />
-                <marker date="1557120101540" expanded="true" signature="11067:11140" ph="update st_ba... " />
-                <marker date="1557120101540" expanded="true" signature="11074:11088" ph="select match... st_ball_status2" />
-                <marker date="1557120101540" expanded="true" signature="11184:11321" ph="insert into comendnotice... " />
-                <marker date="1557120101540" expanded="true" signature="11429:11478" ph="update st_zq... " />
-                <marker date="1557120101540" expanded="true" signature="11533:11589" ph="update st_zq... " />
-                <marker date="1557120101540" expanded="true" signature="11644:11698" ph="update st_zq... " />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="hg3535_lq_status.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lq_status.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="139">
-              <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="hg3535_zq_status.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="588">
-              <caret line="201" column="22" selection-start-line="201" selection-start-column="22" selection-end-line="201" selection-end-column="22" />
-              <folding>
-                <element signature="e#24#35#0" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="hg3535_lanqiu.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lanqiu.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="168">
-              <caret line="34" column="0" selection-start-line="34" selection-start-column="0" selection-end-line="34" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="hg3535_wangqiu.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wangqiu.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="21">
-              <caret line="42" column="31" selection-start-line="42" selection-start-column="31" selection-end-line="42" selection-end-column="31" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-    </leaf>
-  </component>
-  <component name="FileTemplateManagerImpl">
-    <option name="RECENT_TEMPLATES">
-      <list>
-        <option value="Python Script" />
-      </list>
-    </option>
-  </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$/scrapy_yzd/middlewares.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/csdn_self_spider.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/doubanlist_spider.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/jd_spider.py" />
-        <option value="$PROJECT_DIR$/models1.py" />
-        <option value="$PROJECT_DIR$/models2.py" />
-        <option value="$PROJECT_DIR$/test4.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535basketball.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_supplement.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535tennisball.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/settings.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bangqiu.py" />
-        <option value="$PROJECT_DIR$/models.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535bangqiustatus.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535lanqiustatus.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535ballstatusupdate.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535bangqiulstatusupdate.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535lanqiulstatusupdate.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535wangqiustatus.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535wangqiulstatusupdate.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/items.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535ballstatus.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/test.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/autoproxy.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/test1.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/test3.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zuqiu.py" />
-        <option value="$PROJECT_DIR$/requirements.txt" />
-        <option value="$PROJECT_DIR$/model.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status_up.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lq_status.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lq_status_up.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wq_status.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wq_status_up.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status_up.py" />
-        <option value="$PROJECT_DIR$/scrapy_yzd/pipelines.py" />
-        <option value="$PROJECT_DIR$/main.py" />
-      </list>
-    </option>
-  </component>
-  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
-  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
-  <component name="JsGulpfileManager">
-    <detection-done>true</detection-done>
-    <sorting>DEFINITION_ORDER</sorting>
-  </component>
-  <component name="ProjectFrameBounds">
-    <option name="width" value="1280" />
-    <option name="height" value="800" />
-  </component>
-  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
-    <OptionsSetting value="true" id="Add" />
-    <OptionsSetting value="true" id="Remove" />
-    <OptionsSetting value="true" id="Checkout" />
-    <OptionsSetting value="true" id="Update" />
-    <OptionsSetting value="true" id="Status" />
-    <OptionsSetting value="true" id="Edit" />
-    <ConfirmationsSetting value="0" id="Add" />
-    <ConfirmationsSetting value="0" id="Remove" />
-  </component>
-  <component name="ProjectView">
-    <navigator currentView="ProjectPane" proportions="" version="1">
-      <flattenPackages />
-      <showMembers />
-      <showModules />
-      <showLibraryContents />
-      <hideEmptyPackages />
-      <abbreviatePackageNames />
-      <autoscrollToSource />
-      <autoscrollFromSource />
-      <sortByType />
-      <manualOrder />
-      <foldersAlwaysOnTop value="true" />
-    </navigator>
-    <panes>
-      <pane id="ProjectPane">
-        <subPane>
-          <PATH>
-            <PATH_ELEMENT>
-              <option name="myItemId" value="scrapy_yzd" />
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
-            </PATH_ELEMENT>
-          </PATH>
-          <PATH>
-            <PATH_ELEMENT>
-              <option name="myItemId" value="scrapy_yzd" />
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
-            </PATH_ELEMENT>
-            <PATH_ELEMENT>
-              <option name="myItemId" value="scrapy_yzd" />
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
-            </PATH_ELEMENT>
-          </PATH>
-        </subPane>
-      </pane>
-      <pane id="Scratches" />
-      <pane id="Scope" />
-    </panes>
-  </component>
-  <component name="PropertiesComponent">
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/../new_hg3535s-2" />
-    <property name="WebServerToolWindowFactoryState" value="false" />
-    <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
-    <property name="settings.editor.splitter.proportion" value="0.2" />
-    <property name="js-jscs-nodeInterpreter" value="$USER_HOME$/.nvm/versions/node/v6.4.0/bin/node" />
-    <property name="SearchEverywhereHistoryKey" value="&#9;FILE&#9;file:///Users/mac/Downloads/scrapy_yzd/main.py" />
-  </component>
-  <component name="RecentsManager">
-    <key name="CopyFile.RECENT_KEYS">
-      <recent name="$PROJECT_DIR$/scrapy_yzd/spiders" />
-    </key>
-  </component>
-  <component name="RunManager" selected="Python.main">
-    <configuration default="false" name="main" type="PythonConfigurationType" factoryName="Python" temporary="true">
-      <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" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
-      <option name="PARAMETERS" value="" />
-      <option name="SHOW_COMMAND_LINE" value="false" />
-      <method />
-    </configuration>
-    <configuration default="false" name="test3" type="PythonConfigurationType" factoryName="Python" temporary="true">
-      <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$/scrapy_yzd" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/scrapy_yzd/test3.py" />
-      <option name="PARAMETERS" value="" />
-      <option name="SHOW_COMMAND_LINE" value="false" />
-      <method />
-    </configuration>
-    <configuration default="false" name="test1" type="PythonConfigurationType" factoryName="Python" temporary="true">
-      <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$/scrapy_yzd" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/scrapy_yzd/test1.py" />
-      <option name="PARAMETERS" value="" />
-      <option name="SHOW_COMMAND_LINE" value="false" />
-      <method />
-    </configuration>
-    <configuration default="false" name="autoproxy" type="PythonConfigurationType" factoryName="Python" temporary="true">
-      <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$/scrapy_yzd" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/scrapy_yzd/autoproxy.py" />
-      <option name="PARAMETERS" value="" />
-      <option name="SHOW_COMMAND_LINE" value="false" />
-      <method />
-    </configuration>
-    <configuration default="false" name="pipelines" type="PythonConfigurationType" factoryName="Python" temporary="true">
-      <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$/scrapy_yzd" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/scrapy_yzd/pipelines.py" />
-      <option name="PARAMETERS" value="" />
-      <option name="SHOW_COMMAND_LINE" value="false" />
-      <method />
-    </configuration>
-    <configuration default="true" type="DjangoTestsConfigurationType" factoryName="Django tests">
-      <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="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="TARGET" value="" />
-      <option name="SETTINGS_FILE" value="" />
-      <option name="CUSTOM_SETTINGS" value="false" />
-      <option name="USE_OPTIONS" value="false" />
-      <option name="OPTIONS" value="" />
-      <method />
-    </configuration>
-    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
-      <method />
-    </configuration>
-    <configuration default="true" type="PyBehaveRunConfigurationType" factoryName="Behave">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="ADDITIONAL_ARGS" value="" />
-      <method />
-    </configuration>
-    <configuration default="true" type="PyLettuceRunConfigurationType" factoryName="Lettuce">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="ADDITIONAL_ARGS" value="" />
-      <method />
-    </configuration>
-    <configuration default="true" type="PythonConfigurationType" factoryName="Python">
-      <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="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="" />
-      <option name="PARAMETERS" value="" />
-      <option name="SHOW_COMMAND_LINE" value="false" />
-      <method />
-    </configuration>
-    <configuration default="true" type="Tox" factoryName="Tox">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <module name="scrapy_yzd" />
-      <method />
-    </configuration>
-    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
-      <node-interpreter>project</node-interpreter>
-      <node-options />
-      <gulpfile />
-      <tasks />
-      <arguments />
-      <envs />
-      <method />
-    </configuration>
-    <configuration default="true" type="js.build_tools.npm" factoryName="npm">
-      <command value="run-script" />
-      <scripts />
-      <node-interpreter value="project" />
-      <envs />
-      <method />
-    </configuration>
-    <configuration default="true" type="tests" factoryName="Attests">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="" />
-      <option name="CLASS_NAME" value="" />
-      <option name="METHOD_NAME" value="" />
-      <option name="FOLDER_NAME" value="" />
-      <option name="TEST_TYPE" value="TEST_SCRIPT" />
-      <option name="PATTERN" value="" />
-      <option name="USE_PATTERN" value="false" />
-      <method />
-    </configuration>
-    <configuration default="true" type="tests" factoryName="Doctests">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="" />
-      <option name="CLASS_NAME" value="" />
-      <option name="METHOD_NAME" value="" />
-      <option name="FOLDER_NAME" value="" />
-      <option name="TEST_TYPE" value="TEST_SCRIPT" />
-      <option name="PATTERN" value="" />
-      <option name="USE_PATTERN" value="false" />
-      <method />
-    </configuration>
-    <configuration default="true" type="tests" factoryName="Nosetests">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="" />
-      <option name="CLASS_NAME" value="" />
-      <option name="METHOD_NAME" value="" />
-      <option name="FOLDER_NAME" value="" />
-      <option name="TEST_TYPE" value="TEST_SCRIPT" />
-      <option name="PATTERN" value="" />
-      <option name="USE_PATTERN" value="false" />
-      <option name="PARAMS" value="" />
-      <option name="USE_PARAM" value="false" />
-      <method />
-    </configuration>
-    <configuration default="true" type="tests" factoryName="Unittests">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="" />
-      <option name="CLASS_NAME" value="" />
-      <option name="METHOD_NAME" value="" />
-      <option name="FOLDER_NAME" value="" />
-      <option name="TEST_TYPE" value="TEST_SCRIPT" />
-      <option name="PATTERN" value="" />
-      <option name="USE_PATTERN" value="false" />
-      <option name="PUREUNITTEST" value="true" />
-      <option name="PARAMS" value="" />
-      <option name="USE_PARAM" value="false" />
-      <method />
-    </configuration>
-    <configuration default="true" type="tests" factoryName="py.test">
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <envs />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="" />
-      <option name="IS_MODULE_SDK" value="false" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <module name="scrapy_yzd" />
-      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
-      <option name="SCRIPT_NAME" value="" />
-      <option name="CLASS_NAME" value="" />
-      <option name="METHOD_NAME" value="" />
-      <option name="FOLDER_NAME" value="" />
-      <option name="TEST_TYPE" value="TEST_SCRIPT" />
-      <option name="PATTERN" value="" />
-      <option name="USE_PATTERN" value="false" />
-      <option name="testToRun" value="" />
-      <option name="keywords" value="" />
-      <option name="params" value="" />
-      <option name="USE_PARAM" value="false" />
-      <option name="USE_KEYWORD" value="false" />
-      <method />
-    </configuration>
-    <list size="5">
-      <item index="0" class="java.lang.String" itemvalue="Python.main" />
-      <item index="1" class="java.lang.String" itemvalue="Python.test3" />
-      <item index="2" class="java.lang.String" itemvalue="Python.test1" />
-      <item index="3" class="java.lang.String" itemvalue="Python.autoproxy" />
-      <item index="4" class="java.lang.String" itemvalue="Python.pipelines" />
-    </list>
-    <recent_temporary>
-      <list size="5">
-        <item index="0" class="java.lang.String" itemvalue="Python.main" />
-        <item index="1" class="java.lang.String" itemvalue="Python.pipelines" />
-        <item index="2" class="java.lang.String" itemvalue="Python.autoproxy" />
-        <item index="3" class="java.lang.String" itemvalue="Python.test1" />
-        <item index="4" class="java.lang.String" itemvalue="Python.test3" />
-      </list>
-    </recent_temporary>
-  </component>
-  <component name="ShelveChangesManager" show_recycled="false">
-    <option name="remove_strategy" value="false" />
-  </component>
-  <component name="TaskManager">
-    <task active="true" id="Default" summary="Default task">
-      <changelist id="10c8f782-159c-419a-b657-aa18f8ed099d" name="Default" comment="" />
-      <created>1553129611552</created>
-      <option name="number" value="Default" />
-      <option name="presentableId" value="Default" />
-      <updated>1553129611552</updated>
-    </task>
-    <servers />
-  </component>
-  <component name="ToolWindowManager">
-    <frame x="0" y="0" width="1280" height="800" extended-state="6" />
-    <editor active="false" />
-    <layout>
-      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21163167" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
-      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
-      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
-      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.38700566" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
-      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24959612" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.37146893" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
-      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
-      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.329927" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-    </layout>
-    <layout-to-restore>
-      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
-      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
-      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
-      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.31970802" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
-      <window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25767368" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
-      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
-      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24959612" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.41021898" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-    </layout-to-restore>
-  </component>
-  <component name="Vcs.Log.UiProperties">
-    <option name="RECENTLY_FILTERED_USER_GROUPS">
-      <collection />
-    </option>
-    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
-      <collection />
-    </option>
-  </component>
-  <component name="VcsContentAnnotationSettings">
-    <option name="myLimit" value="2678400000" />
-  </component>
-  <component name="XDebuggerManager">
-    <breakpoint-manager>
-      <breakpoints>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/test1.py</url>
-          <line>57</line>
-          <option name="timeStamp" value="100" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zuqiu.py</url>
-          <line>683</line>
-          <option name="timeStamp" value="170" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zuqiu.py</url>
-          <line>684</line>
-          <option name="timeStamp" value="171" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zuqiu.py</url>
-          <line>686</line>
-          <option name="timeStamp" value="172" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zuqiu.py</url>
-          <line>688</line>
-          <option name="timeStamp" value="173" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wangqiu.py</url>
-          <option name="timeStamp" value="202" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>814</line>
-          <option name="timeStamp" value="243" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>810</line>
-          <option name="timeStamp" value="244" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>2781</line>
-          <option name="timeStamp" value="264" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>2849</line>
-          <option name="timeStamp" value="265" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>2848</line>
-          <option name="timeStamp" value="266" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>2608</line>
-          <option name="timeStamp" value="269" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>2676</line>
-          <option name="timeStamp" value="270" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>111</line>
-          <option name="timeStamp" value="279" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>2793</line>
-          <option name="timeStamp" value="285" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>717</line>
-          <option name="timeStamp" value="286" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status_up.py</url>
-          <line>287</line>
-          <option name="timeStamp" value="310" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status_up.py</url>
-          <line>208</line>
-          <option name="timeStamp" value="316" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status_up.py</url>
-          <line>216</line>
-          <option name="timeStamp" value="317" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>3386</line>
-          <option name="timeStamp" value="326" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>3384</line>
-          <option name="timeStamp" value="327" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status_up.py</url>
-          <line>215</line>
-          <option name="timeStamp" value="330" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status_up.py</url>
-          <line>216</line>
-          <option name="timeStamp" value="331" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status_up.py</url>
-          <line>237</line>
-          <option name="timeStamp" value="332" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lq_status_up.py</url>
-          <line>197</line>
-          <option name="timeStamp" value="333" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lq_status_up.py</url>
-          <line>215</line>
-          <option name="timeStamp" value="334" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status_up.py</url>
-          <line>200</line>
-          <option name="timeStamp" value="335" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wq_status.py</url>
-          <line>182</line>
-          <option name="timeStamp" value="336" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wq_status.py</url>
-          <line>180</line>
-          <option name="timeStamp" value="337" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wq_status_up.py</url>
-          <line>212</line>
-          <option name="timeStamp" value="338" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>3230</line>
-          <option name="timeStamp" value="341" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>3231</line>
-          <option name="timeStamp" value="342" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>3306</line>
-          <option name="timeStamp" value="343" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
-          <line>249</line>
-          <option name="timeStamp" value="344" />
-        </line-breakpoint>
-      </breakpoints>
-      <breakpoints-dialog>
-        <breakpoints-dialog />
-      </breakpoints-dialog>
-      <option name="time" value="346" />
-    </breakpoint-manager>
-    <watches-manager>
-      <configuration name="PythonConfigurationType">
-        <watch expression="item.half_full.__len__()" />
-      </configuration>
-    </watches-manager>
-  </component>
-  <component name="editorHistoryManager">
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/signalmanager.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="139">
-          <caret line="60" column="0" selection-start-line="60" selection-start-column="0" selection-end-line="60" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/core/engine.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="139">
-          <caret line="317" column="0" selection-start-line="317" selection-start-column="0" selection-end-line="317" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/signals.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="197">
-          <caret line="11" column="24" selection-start-line="11" selection-start-column="24" selection-end-line="11" selection-end-column="24" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/pydispatch/robustapply.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="375">
-          <caret line="54" column="0" selection-start-line="54" selection-start-column="0" selection-end-line="54" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/utils/signal.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="134">
-          <caret line="59" column="22" selection-start-line="59" selection-start-column="22" selection-end-line="59" selection-end-column="22" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/Library/Caches/PyCharm2016.2/python_stubs/-216135890/itertools.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/__init__.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="241">
-          <caret line="129" column="0" selection-start-line="129" selection-start-column="0" selection-end-line="129" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test4.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="13881">
-          <caret line="667" column="23" selection-start-line="667" selection-start-column="0" selection-end-line="668" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/internet/base.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="17997">
-          <caret line="888" column="0" selection-start-line="888" selection-start-column="0" selection-end-line="888" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/conf.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="210">
-          <caret line="10" column="27" selection-start-line="10" selection-start-column="27" selection-end-line="10" selection-end-column="27" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/douban_spider.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="49">
-          <caret line="13" column="16" selection-start-line="13" selection-start-column="16" selection-end-line="13" selection-end-column="16" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/internet/task.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="375">
-          <caret line="671" column="0" selection-start-line="671" selection-start-column="0" selection-end-line="671" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/internet/defer.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="160">
-          <caret line="654" column="0" selection-start-line="654" selection-start-column="0" selection-end-line="654" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/csdn_self_spider.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="84">
-          <caret line="5" column="16" selection-start-line="5" selection-start-column="12" selection-end-line="5" selection-end-column="16" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/doubanlist_spider.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="238">
-          <caret line="57" column="20" selection-start-line="57" selection-start-column="20" selection-end-line="57" selection-end-column="20" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/jd_spider.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="315">
-          <caret line="57" column="65" selection-start-line="57" selection-start-column="65" selection-end-line="57" selection-end-column="65" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/steam_spider.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="114">
-          <caret line="86" column="49" selection-start-line="86" selection-start-column="49" selection-end-line="86" selection-end-column="49" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/__init__.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/requirements.txt">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/README.md">
-      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
-        <state split_layout="SPLIT">
-          <first_editor relative-caret-position="0">
-            <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-            <folding />
-          </first_editor>
-          <second_editor />
-        </state>
-      </provider>
-      <provider editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
-        <state split_layout="SPLIT">
-          <first_editor relative-caret-position="0">
-            <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-            <folding />
-          </first_editor>
-          <second_editor>
-            <js_state />
-          </second_editor>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/models.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-2476">
-          <caret line="9" column="29" selection-start-line="9" selection-start-column="11" selection-end-line="9" selection-end-column="29" />
-          <folding>
-            <element signature="e#0#15#0" expanded="false" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/test.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="21">
-          <caret line="5" column="17" selection-start-line="5" selection-start-column="17" selection-end-line="5" selection-end-column="17" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bangqiu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="21">
-          <caret line="100" column="49" selection-start-line="100" selection-start-column="42" selection-end-line="100" selection-end-column="49" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/middlewares.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="364">
-          <caret line="53" column="0" selection-start-line="53" selection-start-column="0" selection-end-line="53" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/autoproxy.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="364">
-          <caret line="53" column="39" selection-start-line="53" selection-start-column="39" selection-end-line="53" selection-end-column="39" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/enterprise/adbapi.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="118">
-          <caret line="467" column="0" selection-start-line="467" selection-start-column="0" selection-end-line="467" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/_threads/_team.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="223">
-          <caret line="193" column="0" selection-start-line="193" selection-start-column="0" selection-end-line="193" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/_threads/_threadworker.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="118">
-          <caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/threading.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="139">
-          <caret line="863" column="0" selection-start-line="863" selection-start-column="0" selection-end-line="863" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wq_status_up.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-5295">
-          <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
-          <folding>
-            <marker date="1557120061659" expanded="true" signature="5966:6022" ph="select match... st_ball_status" />
-            <marker date="1557120061659" expanded="true" signature="9819:9868" ph="update st_wq... " />
-            <marker date="1557120061659" expanded="true" signature="9931:9987" ph="update st_wq... " />
-            <marker date="1557120061659" expanded="true" signature="10050:10104" ph="update st_wq... " />
-            <marker date="1557120061659" expanded="true" signature="11249:11298" ph="update st_wq... " />
-            <marker date="1557120061659" expanded="true" signature="11353:11409" ph="update st_wq... " />
-            <marker date="1557120061659" expanded="true" signature="11464:11518" ph="update st_wq... " />
-            <marker date="1557120061659" expanded="true" signature="11475:11518" ph="update st_lq... " />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/python/threadpool.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="328">
-          <caret line="258" column="0" selection-start-line="258" selection-start-column="0" selection-end-line="258" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/python/context.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="139">
-          <caret line="121" column="0" selection-start-line="121" selection-start-column="0" selection-end-line="121" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_supplement.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="231">
-          <caret line="16" column="28" selection-start-line="16" selection-start-column="28" selection-end-line="16" selection-end-column="28" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wq_status.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="217">
-          <caret line="199" column="32" selection-start-line="199" selection-start-column="32" selection-end-line="199" selection-end-column="32" />
-          <folding>
-            <element signature="e#24#35#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/items.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="139">
-          <caret line="183" column="27" selection-start-line="183" selection-start-column="27" selection-end-line="183" selection-end-column="27" />
-          <folding>
-            <marker date="1557111991005" expanded="true" signature="698:886" ph="INSERT INTO st_zq_odds... " />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/settings.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="364">
-          <caret line="120" column="0" selection-start-line="120" selection-start-column="0" selection-end-line="120" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/test1.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="364">
-          <caret line="704" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="704" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/test3.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="364">
-          <caret line="631" column="10" selection-start-line="631" selection-start-column="10" selection-end-line="631" selection-end-column="10" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/__init__.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lq_status_up.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="157">
-          <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
-          <folding>
-            <marker date="1557120014554" expanded="true" signature="5965:6021" ph="select match... st_ball_status" />
-            <marker date="1557120014554" expanded="true" signature="9485:9555" ph="update st_ba... " />
-            <marker date="1557120014554" expanded="true" signature="9612:9773" ph="insert into comendnotice... " />
-            <marker date="1557120014554" expanded="true" signature="9818:9867" ph="update st_lq... " />
-            <marker date="1557120014554" expanded="true" signature="9930:9986" ph="update st_lq... " />
-            <marker date="1557120014554" expanded="true" signature="10049:10103" ph="update st_lq... " />
-            <marker date="1557120014554" expanded="true" signature="10858:10928" ph="update st_ba... " />
-            <marker date="1557120014554" expanded="true" signature="10977:11138" ph="insert into comendnotice... " />
-            <marker date="1557120014554" expanded="true" signature="11248:11297" ph="update st_lq... " />
-            <marker date="1557120014554" expanded="true" signature="11352:11408" ph="update st_lq... " />
-            <marker date="1557120014554" expanded="true" signature="11463:11517" ph="update st_lq... " />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="139">
-          <caret line="12" column="35" selection-start-line="12" selection-start-column="35" selection-end-line="12" selection-end-column="35" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bq_status_up.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="178">
-          <caret line="196" column="42" selection-start-line="196" selection-start-column="42" selection-end-line="196" selection-end-column="42" />
-          <folding>
-            <element signature="e#25#40#0" expanded="true" />
-            <marker date="1557119962650" expanded="true" signature="5966:6022" ph="select match... st_ball_status" />
-            <marker date="1557119962650" expanded="true" signature="9345:9394" ph="update st_bq... " />
-            <marker date="1557119962650" expanded="true" signature="9457:9513" ph="update st_bq... " />
-            <marker date="1557119962650" expanded="true" signature="9576:9630" ph="update st_bq... " />
-            <marker date="1557119962650" expanded="true" signature="9834:9904" ph="update st_ba... " />
-            <marker date="1557119962650" expanded="true" signature="9961:10122" ph="insert into comendnotice... " />
-            <marker date="1557119962650" expanded="true" signature="10859:10929" ph="update st_ba... " />
-            <marker date="1557119962650" expanded="true" signature="10978:11139" ph="insert into comendnotice... " />
-            <marker date="1557119962650" expanded="true" signature="11250:11299" ph="update st_bq... " />
-            <marker date="1557119962650" expanded="true" signature="11354:11410" ph="update st_bq... " />
-            <marker date="1557119962650" expanded="true" signature="11465:11519" ph="update st_bq... " />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="588">
-          <caret line="201" column="22" selection-start-line="201" selection-start-column="22" selection-end-line="201" selection-end-column="22" />
-          <folding>
-            <element signature="e#24#35#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/model.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lq_status.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="139">
-          <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/pipelines.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="24097">
-          <caret line="3211" column="15" selection-start-line="3211" selection-start-column="15" selection-end-line="3211" selection-end-column="15" />
-          <folding>
-            <element signature="e#275#312#0" expanded="true" />
-            <element signature="e#79131#79159#0" expanded="false" />
-            <element signature="e#170505#170541#0" expanded="false" />
-            <element signature="e#171886#177049#0" expanded="false" />
-            <element signature="e#178364#178398#0" expanded="false" />
-            <element signature="e#243234#245792#0" expanded="false" />
-            <element signature="e#245837#248393#0" expanded="false" />
-            <element signature="e#248438#250995#0" expanded="false" />
-            <marker date="1557135609211" expanded="true" signature="60256:60486" ph="insert into st_zq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="60877:61053" ph="insert into st_zq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="61551:61781" ph="insert into st_zq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="62177:62353" ph="insert into st_zq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="174497:174756" ph="insert into st_zq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="174497:174769" ph="insert into st_zq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="175091:175293" ph="insert into st_zq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="175912:176171" ph="insert into st_zq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="175912:176184" ph="insert into st_zq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="176505:176707" ph="insert into st_zq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="180565:180816" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="180565:180830" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="181161:181356" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="181590:182020" ph="insert into st_lq_result... " />
-            <marker date="1557135609211" expanded="true" signature="182335:182602" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="183171:183420" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="183171:183434" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="183717:183912" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="184118:184548" ph="insert into st_lq_result... " />
-            <marker date="1557135609211" expanded="true" signature="184863:185130" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="185703:185952" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="185703:185966" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="186252:186446" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="186656:187086" ph="insert into st_lq_result... " />
-            <marker date="1557135609211" expanded="true" signature="187401:187668" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="188244:188493" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="188244:188506" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="188772:188966" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="189154:189584" ph="insert into st_lq_result... " />
-            <marker date="1557135609211" expanded="true" signature="189887:190154" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="190731:190980" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="190731:190993" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="191260:191454" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="191643:192073" ph="insert into st_lq_result... " />
-            <marker date="1557135609211" expanded="true" signature="192380:192647" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="193146:193382" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="193146:193396" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="193644:193823" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="193993:194423" ph="insert into st_lq_result... " />
-            <marker date="1557135609211" expanded="true" signature="194726:194993" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="195560:195809" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="195560:195822" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="196110:196304" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="196512:196942" ph="insert into st_lq_result... " />
-            <marker date="1557135609211" expanded="true" signature="197257:197524" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="197752:198001" ph="insert into st_lq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="197752:198018" ph="insert into st_lq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="201864:202114" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="201864:202127" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="202442:202637" ph="insert into st_wq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="202902:203441" ph="insert into st_wq_result... " />
-            <marker date="1557135609211" expanded="true" signature="203738:204168" ph="insert into st_lq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="204691:204928" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="204691:204941" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="205209:205389" ph="insert into st_wq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="205579:206118" ph="insert into st_wq_result... " />
-            <marker date="1557135609211" expanded="true" signature="206683:206933" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="206683:206947" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="207261:207456" ph="insert into st_wq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="207691:208230" ph="insert into st_wq_result... " />
-            <marker date="1557135609211" expanded="true" signature="208805:209055" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="208805:209068" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="209392:209587" ph="insert into st_wq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="209834:210373" ph="insert into st_wq_result... " />
-            <marker date="1557135609211" expanded="true" signature="210942:211192" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="210942:211205" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="211523:211718" ph="insert into st_wq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="211938:212477" ph="insert into st_wq_result... " />
-            <marker date="1557135609211" expanded="true" signature="212766:213000" ph="insert into st_wq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="216250:216481" ph="insert into st_wq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="216790:216966" ph="insert into st_wq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="217483:217714" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="217988:218164" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="218643:218874" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="219152:219328" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="219804:220035" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="220296:220472" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="220939:221170" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="221432:221608" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="222007:222224" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="222466:222627" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="223078:223309" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="223587:223763" ph="insert into st_lq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="223979:224198" ph="insert into st_lq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="224897:225190" ph="insert into st_bq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="225596:225792" ph="insert into st_bq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="226057:226497" ph="insert into st_bq_result... " />
-            <marker date="1557135609211" expanded="true" signature="231220:231500" ph="insert into st_bq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="231824:232004" ph="insert into st_bq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="232201:232641" ph="insert into st_bq_result... " />
-            <marker date="1557135609211" expanded="true" signature="232631:232641" ph="insert into st_bq_result... " />
-            <marker date="1557135609211" expanded="true" signature="232927:233101" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="232927:233156" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="232927:233157" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="232927:233165" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="233660:233940" ph="insert into st_bq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="234274:234454" ph="insert into st_bq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="234666:235106" ph="insert into st_bq_result... " />
-            <marker date="1557135609211" expanded="true" signature="235398:235636" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="236107:236370" ph="insert into st_bq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="236685:236880" ph="insert into st_bq_odds_record... " />
-            <marker date="1557135609211" expanded="true" signature="237145:237585" ph="insert into st_bq_result... " />
-            <marker date="1557135609211" expanded="true" signature="237876:238292" ph="insert into st_bq_result_record... " />
-            <marker date="1557135609211" expanded="true" signature="238531:238811" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="238989:239339" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="239559:239909" ph="insert into st_bq_competition... " />
-            <marker date="1557135609211" expanded="true" signature="242000:242160" ph="insert into st_ball_status2... " />
-            <marker date="1557135609211" expanded="true" signature="242189:242297" ph="insert into st_lq_odds... " />
-            <marker date="1557135609211" expanded="true" signature="242427:242476" ph="update st_zq... " />
-            <marker date="1557135609211" expanded="true" signature="242521:242577" ph="update st_zq... " />
-            <marker date="1557135609211" expanded="true" signature="242622:242676" ph="update st_zq... " />
-            <marker date="1557135609211" expanded="true" signature="245008:245168" ph="insert into st_ball_status... " />
-            <marker date="1557135609211" expanded="true" signature="247609:247769" ph="insert into st_ball_status... " />
-            <marker date="1557135609211" expanded="true" signature="250211:250371" ph="insert into st_ball_status... " />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/main.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="189">
-          <caret line="12" column="46" selection-start-line="12" selection-start-column="46" selection-end-line="12" selection-end-column="46" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_lanqiu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="168">
-          <caret line="34" column="0" selection-start-line="34" selection-start-column="0" selection-end-line="34" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_wangqiu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="21">
-          <caret line="42" column="31" selection-start-line="42" selection-start-column="31" selection-end-line="42" selection-end-column="31" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zq_status_up.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="217">
-          <caret line="273" column="54" selection-start-line="273" selection-start-column="54" selection-end-line="273" selection-end-column="54" />
-          <folding>
-            <element signature="e#25#40#0" expanded="true" />
-            <marker date="1557120101540" expanded="true" signature="6202:6237" ph="select match... st_ball_status2" />
-            <marker date="1557120101540" expanded="true" signature="6202:6258" ph="select match... st_ball_status" />
-            <marker date="1557120101540" expanded="true" signature="8702:8772" ph="update st_ba... " />
-            <marker date="1557120101540" expanded="true" signature="8829:8966" ph="insert into comendnotice... " />
-            <marker date="1557120101540" expanded="true" signature="9719:9789" ph="update st_ba... " />
-            <marker date="1557120101540" expanded="true" signature="9846:9983" ph="insert into comendnotice... " />
-            <marker date="1557120101540" expanded="true" signature="10028:10077" ph="update st_zq... " />
-            <marker date="1557120101540" expanded="true" signature="10028:10079" ph="update st_zq... " />
-            <marker date="1557120101540" expanded="true" signature="10140:10196" ph="update st_zq... " />
-            <marker date="1557120101540" expanded="true" signature="10259:10313" ph="update st_zq... " />
-            <marker date="1557120101540" expanded="true" signature="11067:11137" ph="update st_ba... " />
-            <marker date="1557120101540" expanded="true" signature="11067:11140" ph="update st_ba... " />
-            <marker date="1557120101540" expanded="true" signature="11074:11088" ph="select match... st_ball_status2" />
-            <marker date="1557120101540" expanded="true" signature="11184:11321" ph="insert into comendnotice... " />
-            <marker date="1557120101540" expanded="true" signature="11429:11478" ph="update st_zq... " />
-            <marker date="1557120101540" expanded="true" signature="11533:11589" ph="update st_zq... " />
-            <marker date="1557120101540" expanded="true" signature="11644:11698" ph="update st_zq... " />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_zuqiu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="21">
-          <caret line="71" column="25" selection-start-line="71" selection-start-column="25" selection-end-line="71" selection-end-column="25" />
-          <folding>
-            <element signature="e#42#57#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-  </component>
-</project>

BIN
scrapy_yzd/.scrapy/deltafetch/ball_status.db


BIN
scrapy_yzd/.scrapy/deltafetch/bangqiu.db


BIN
scrapy_yzd/.scrapy/deltafetch/hg3535.db


BIN
scrapy_yzd/.scrapy/deltafetch/hg3535_supplement.db


BIN
scrapy_yzd/.scrapy/deltafetch/lanqiu.db


BIN
scrapy_yzd/.scrapy/deltafetch/tennis.db


+ 0 - 9
scrapy_yzd/README.md

@@ -1,9 +0,0 @@
-# scrapy_yzd
-该项目为scrapy框架,整合了自动切换agent,自动切换代理ip的中间件,可以下载后自行编写爬虫。
-支持:
- - 豆瓣电影
- - 京东商品信息(名称价格等)
-## agent中间件
-自动切换agent
-## 代理中间件
-采用网友的中间件,自动从3个免费代理网站爬取代理并测试

BIN
scrapy_yzd/__pycache__/models.cpython-36.pyc


+ 0 - 25
scrapy_yzd/main.py

@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-__author__ = 'admin'
-__date__ = '2018/3/7 上午10:06'
-
-from scrapy.cmdline import execute
-
-import sys
-import os
-
-
-# print(os.path.dirname(os.path.abspath(__file__)))
-sys.path.append(os.path.dirname(os.path.abspath(__file__)))
-execute(["scrapy", "crawl", "hg3535"])  # 足球爬虫
-# execute(["scrapy", "crawl", "hg3535_supplement"]) #赔率补充爬虫
-# execute(["scrapy", "crawl", "lanqiu"])# 篮球爬虫
-# execute(["scrapy", "crawl", "tennis"])#网球爬虫
-# execute(["scrapy", "crawl", "ball_status"])#足球状态id抓取爬虫
-# execute(["scrapy", "crawl", "ball_status_update"]) # 足球状态更新爬虫
-# execute(["scrapy", "crawl", "bangqiu"])# 棒球爬虫
-# execute(["scrapy", "crawl", "bangqiu_status"]) #棒球状态id抓取爬虫
-# execute(["scrapy", "crawl", "bangqiu_status_update"]) #棒球状态更新爬虫
-# execute(["scrapy", "crawl", "lanqiu_status"]) # 篮球状态id抓取爬虫
-# execute(["scrapy", "crawl", "lanqiu_status_update"]) #篮球状态更新爬虫
-# execute(["scrapy", "crawl", "wangqiu_status"]) #网球状态id抓取爬虫
-# execute(["scrapy", "crawl", "wangqiu_status_update"]) # 网球状态更新爬虫

+ 0 - 0
scrapy_yzd/model.py


+ 0 - 193
scrapy_yzd/models.py

@@ -1,193 +0,0 @@
-import psycopg2
-from peewee import *
-# from psycopg2.psycopg1 import connection
-# from psycopg2.psycopg1 import connection
-# from psycopg2.extras import DictCursor
-# from twisted.conch.scripts.conch import conn
-
-# cursor = conn.cursor(cursor_factory=DictCursor)
-# connection.cursor()
-database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-# database = PostgresqlDatabase('postgres', **{'host': '127.0.0.1', 'port': 5432, 'user': 'postgres', 'password': '9998877'})
-
-class UnknownField(object):
-    def __init__(self, *_, **__): pass
-
-class BaseModel(Model):
-    class Meta:
-        pass
-        database = database
-
-
-class StZqOdds(BaseModel):
-    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    ctime = DateTimeField()
-    expire_time = DateTimeField(null=True)
-    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_id_seq'::regclass)")])
-    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
-    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
-    max = FloatField(constraints=[SQL("DEFAULT 99")])
-    min = FloatField(constraints=[SQL("DEFAULT 0")])
-    odds = FloatField()
-    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
-    sole = CharField(constraints=[SQL("DEFAULT ''::character varying")], unique=True)
-    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
-    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    status = IntegerField(constraints=[SQL("DEFAULT 0")])
-    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    type = IntegerField(constraints=[SQL("DEFAULT 0")])
-    utime = DateTimeField()
-    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")])
-
-
-    class Meta:
-        table_name = 'st_zq_odds'
-        primary_key = False
-
-
-
-#赔率记录表
-class StZqOddsRecord(BaseModel):
-    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    ctime = DateTimeField(null=True)
-    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_record_id_seq'::regclass)")])
-    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
-    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
-    max = FloatField(constraints=[SQL("DEFAULT 99")])
-    min = FloatField(constraints=[SQL("DEFAULT 0")])
-    odds = FloatField()
-    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
-    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
-    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
-    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    status = IntegerField(constraints=[SQL("DEFAULT 0")])
-    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
-    type = IntegerField(constraints=[SQL("DEFAULT 0")])
-    utime = DateTimeField(null=True)
-    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")])
-
-
-    class Meta:
-        table_name = 'st_zq_odds_record'
-        primary_key = False
-
-
-
-
-
-
-
-
-class StZqResult(BaseModel):
-    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")])
-    first_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
-    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")])
-    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
-    guest_team = CharField()
-    home_rate = FloatField(constraints=[SQL("DEFAULT 0")])
-    home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
-    home_team = CharField()
-    last_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
-    lg_id = IntegerField()
-    match_id = BigIntegerField()
-    match_process = CharField()
-    match_score = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
-    match_time = CharField()
-    match_winer = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
-    source = CharField(null=True)
-    status = IntegerField(constraints=[SQL("DEFAULT 0")])
-    tag = IntegerField(constraints=[SQL("DEFAULT 0")])
-    u_guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
-    u_home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
-    update_time = DateTimeField()
-    p_code = CharField(null=True)
-
-    class Meta:
-        table_name = 'st_zq_result'
-
-
-
-class StZqResultRecord(BaseModel):
-    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    first_score = CharField(null=True)
-    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
-    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    guest_team = CharField()
-    home_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
-    home_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    home_team = CharField()
-    last_score = CharField(null=True)
-    lg_id = BigIntegerField()
-    match_id = BigIntegerField()
-    match_process = CharField()
-    match_score = CharField(null=True)
-    match_time = CharField()
-    match_winer = CharField(null=True)
-    source = CharField(null=True)
-    status = IntegerField()
-    tag = IntegerField(null=True)
-    update_time = DateTimeField()
-    p_code = CharField(null=True)
-
-    class Meta:
-        table_name = 'st_zq_result_record'
-
-
-
-class StZqCompetition(BaseModel):
-    ctime = DateTimeField(null=True)
-    expire_time = DateTimeField(null=True)
-    guest_team = CharField()
-    home_team = CharField()
-    is_morningplate = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    is_stringscene = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    is_today = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    match_date = DateField(null=True)
-    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True, unique=True)
-    match_time = TimeField(null=True)
-    recommend = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
-    sg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
-    status = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
-    tag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-    utime = DateTimeField(null=True)
-    us_time = DateTimeField(null=True)
-
-    class Meta:
-        table_name = 'st_zq_competition'
-
-
-
-#联赛表
-# class StZqLeague(BaseModel):
-#     area_id = IntegerField(constraints=[SQL("DEFAULT 0")])
-#     begin_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
-#     bf_ifdisplay = IntegerField(column_name='bf_Ifdisplay', constraints=[SQL("DEFAULT 0")], null=True)
-#     count_round = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
-#     country_id = IntegerField(constraints=[SQL("DEFAULT 0")])
-#     curr_round = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-#     hot = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-#     id = BigAutoField()
-#     if_have_sub = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-#     if_stop = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-#     kind = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
-#     last_time = DateTimeField(null=True)
-#     league_list = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
-#     league_pic = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
-#     lg_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True)
-#     match_mode = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
-#     match_season = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
-#     name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
-#     name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
-#     source = CharField(null=True)
-#
-#     class Meta:
-#         table_name = 'st_zq_league'

+ 0 - 69
scrapy_yzd/requirements.txt

@@ -1,69 +0,0 @@
-asn1crypto==0.24.0
-attrs==18.2.0
-Automat==0.7.0
-beautifulsoup4==4.6.3
-blinker==1.4
-brotlipy==0.7.0
-bs4==0.0.1
-bsddb3==6.2.6
-certifi==2018.11.29
-cffi==1.11.5
-chardet==3.0.4
-click==6.7
-constantly==15.1.0
-cryptography==2.3.1
-cssselect==1.0.3
-dukpy==0.2.2
-future==0.17.1
-h11==0.7.0
-h2==3.1.0
-hpack==3.0.0
-html5lib==1.0.1
-hyperframe==5.2.0
-hyperlink==18.0.0
-idna==2.8
-incremental==17.5.0
-javascripthon==0.10
-jmespath==0.9.4
-jsonpath==0.81
-jupyter-echarts-pypkg==0.1.2
-kaitaistruct==0.8
-ldap3==2.5.2
-lml==0.0.2
-lxml==4.2.5
-macropy3==1.1.0b2
-MarkupSafe==1.1.0
-parsel==1.5.1
-passlib==1.7.1
-peewee==3.9.3
-Pillow==5.3.0
-psycopg2==2.7.7
-pyasn1==0.4.4
-pyasn1-modules==0.2.2
-pycparser==2.19
-PyDispatcher==2.0.5
-pyecharts-javascripthon==0.0.6
-pyecharts-jupyter-installer==0.0.3
-pyecharts-snapshot==0.1.10
-PyHamcrest==1.9.0
-PyMySQL==0.9.3
-pyOpenSSL==18.0.0
-pyparsing==2.2.2
-pyperclip==1.6.5
-queuelib==1.5.0
-requests==2.21.0
-ruamel.yaml==0.15.94
-Scrapy==1.5.1
-scrapy-deltafetch==1.2.1
-selenium==3.141.0
-service-identity==18.1.0
-six==1.12.0
-sortedcontainers==2.0.5
-tornado==5.1.1
-Twisted==18.9.0
-urllib3==1.24.1
-urwid==2.0.1
-w3lib==1.19.0
-webencodings==0.5.1
-wsproto==0.11.0
-zope.interface==4.6.0

+ 0 - 11
scrapy_yzd/scrapy.cfg

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

+ 0 - 0
scrapy_yzd/scrapy_yzd/__init__.py


BIN
scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/pipelines.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-36.pyc


+ 0 - 349
scrapy_yzd/scrapy_yzd/autoproxy.py

@@ -1,349 +0,0 @@
-# #! -*- coding: utf-8 -*-
-# # import urllib2
-# import logging
-# import threading
-# import math
-# import re
-# import time
-#
-# from bs4 import BeautifulSoup
-# from twisted.internet import defer
-# from twisted.internet.error import TimeoutError, ConnectionRefusedError, \
-#     ConnectError, ConnectionLost, TCPTimedOutError, ConnectionDone
-#
-# logger = logging.getLogger(__name__)
-#
-#
-# class AutoProxyMiddleware(object):
-#
-#     EXCEPTIONS_TO_CHANGE = (defer.TimeoutError, TimeoutError, ConnectionRefusedError, ConnectError, ConnectionLost, TCPTimedOutError, ConnectionDone)
-#
-#     _settings = [
-#         ('enable', True),
-#         ('test_urls', [('http://www.w3school.com.cn', '06004630'), ]),
-#         ('test_proxy_timeout', 5),
-#         ('download_timeout', 60),
-#         ('test_threadnums', 20),
-#         ('ban_code', [503, ]),
-#         ('ban_re', r''),
-#         ('proxy_least', 3),
-#         ('init_valid_proxys', 1),
-#         ('invalid_limit', 200),
-#     ]
-#
-#     def __init__(self, proxy_set=None):
-#         self.proxy_set = proxy_set or {}
-#         for k, v in self._settings:
-#             setattr(self, k, self.proxy_set.get(k, v))
-#
-#         # 代理列表和当前的代理指针,couter_proxy用作该代理下载的网页数量
-#         self.proxy = []
-#         self.proxy_index = 0
-#         self.proxyes = {}
-#         self.counter_proxy = {}
-#
-#         self.fetch_new_proxy()
-#         self.test_proxyes(self.proxyes, wait=True)
-#         logger.info('Use proxy : %s', self.proxy)
-#
-#     @classmethod
-#     def from_crawler(cls, crawler):
-#         return cls(crawler.settings.getdict('AUTO_PROXY'))
-#
-#     def process_request(self, request, spider):
-#         if not self._is_enabled_for_request(request):
-#             return
-#
-#         if self.len_valid_proxy() > 0:
-#             self.set_proxy(request)
-#             # if 'download_timeout' not in request.meta:
-#             request.meta['download_timeout'] = self.download_timeout
-#         else:
-#             # 没有可用代理,直连
-#             if 'proxy' in request.meta:
-#                 del request.meta['proxy']
-#
-#     def process_response(self, request, response, spider):
-#         if not self._is_enabled_for_request(request):
-#             return response
-#
-#         if response.status in self.ban_code:
-#             self.invaild_proxy(request.meta['proxy'])
-#             logger.debug("Proxy[%s] ban because return httpstatuscode:[%s]. ", request.meta['proxy'], str(response.status))
-#             new_request = request.copy()
-#             new_request.dont_filter = True
-#             return new_request
-#
-#         if self.ban_re:
-#             try:
-#                 pattern = re.compile(self.ban_re)
-#             except TypeError:
-#                 logger.error('Wrong "ban_re", please check settings')
-#                 return response
-#             match = re.search(pattern, response.body)
-#             if match:
-#                 self.invaild_proxy(request.meta['proxy'])
-#                 logger.debug("Proxy[%s] ban because pattern match:[%s]. ", request.meta['proxy'], str(match))
-#                 new_request = request.copy()
-#                 new_request.dont_filter = True
-#                 return new_request
-#
-#         p = request.meta['proxy']
-#         self.counter_proxy[p] = self.counter_proxy.setdefault(p, 1) + 1
-#         return response
-#
-#     def process_exception(self, request, exception, spider):
-#         if isinstance(exception, self.EXCEPTIONS_TO_CHANGE) \
-#                 and request.meta.get('proxy', False):
-#             self.invaild_proxy(request.meta['proxy'])
-#             logger.debug("Proxy[%s] connect exception[%s].", request.meta['proxy'], exception)
-#             new_request = request.copy()
-#             new_request.dont_filter = True
-#             return new_request
-#
-#     def invaild_proxy(self, proxy):
-#         """
-#         将代理设为invaild。如果之前该代理已下载超过200页(默认)的资源,则暂时不设置,仅切换代理,并减少其计数。
-#         """
-#         if self.counter_proxy.get(proxy, 0) > self.invalid_limit:
-#             self.counter_proxy[proxy] = self.counter_proxy.get(proxy, 0) - 50
-#             if self.counter_proxy[proxy] < 0:
-#                 self.counter_proxy[proxy] = 0
-#             self.change_proxy()
-#         else:
-#             self.proxyes[proxy] = False
-#             # logger.info('Set proxy[%s] invaild.', proxy)
-#
-#     def change_proxy(self):
-#         """
-#         切换代理。
-#         """
-#         while True:
-#             self.proxy_index = (self.proxy_index + 1) % len(self.proxy)
-#             proxy_valid = self.proxyes[self.proxy[self.proxy_index]]
-#             if proxy_valid:
-#                 break
-#             if self.len_valid_proxy() == 0:
-#                 logger.info('Available proxys is none.Waiting for fetch new proxy.')
-#                 break
-#         logger.info('Change proxy to %s', self.proxy[self.proxy_index])
-#         logger.info('Available proxys[%s]: %s', self.len_valid_proxy(), self.valid_proxyes())
-#
-#         # 可用代理数量小于预设值则扩展代理
-#         if self.len_valid_proxy() < self.proxy_least:
-#             self.extend_proxy()
-#
-#     def set_proxy(self, request):
-#         """
-#         设置代理。
-#         """
-#         proxy_valid = self.proxyes[self.proxy[self.proxy_index]]
-#         if not proxy_valid:
-#             self.change_proxy()
-#
-#         request.meta['proxy'] = self.proxy[self.proxy_index]
-#         # logger.info('Set proxy. request.meta: %s', request.meta)
-#
-#     def len_valid_proxy(self):
-#         """
-#         计算可用代理的数量
-#         """
-#         count = 0
-#         for p in self.proxy:
-#             if self.proxyes[p]:
-#                 count += 1
-#         return count
-#
-#     def valid_proxyes(self):
-#         """
-#         可用代理列表
-#         """
-#         proxyes = []
-#         for p in self.proxy:
-#             if self.proxyes[p]:
-#                 proxyes.append(p)
-#         return proxyes
-#
-#     def extend_proxy(self):
-#         """
-#         扩展代理。测试代理是异步的。
-#         """
-#         self.fetch_new_proxy()
-#         self.test_proxyes(self.proxyes)
-#
-#     def append_proxy(self, p):
-#         """
-#         辅助函数,将测试通过的代理添加到列表
-#         """
-#         if p not in self.proxy:
-#             self.proxy.append(p)
-#
-#     def fetch_new_proxy(self):
-#         """
-#         获取新的代理,目前从三个网站抓取代理,每个网站开一个线程抓取代理。
-#         """
-#         logger.info('Starting fetch new proxy.')
-#         urls = ['xici', 'ip3336', 'kxdaili']
-#         threads = []
-#         for url in urls:
-#             t = ProxyFetch(self.proxyes, url)
-#             threads.append(t)
-#             t.start()
-#         for t in threads:
-#             t.join()
-#
-#     def test_proxyes(self, proxyes, wait=False):
-#         """
-#         测试代理可通性。测试网址、特征码以及测试线程数均可设置。
-#         """
-#         list_proxy = proxyes.items()
-#         threads = []
-#         n = int(math.ceil(len(list_proxy) / self.test_threadnums))
-#         for i in range(self.test_threadnums):
-#             # 将待测试的代理平均分给测试线程
-#             list_part = list_proxy[i * n: (i + 1) * n]
-#             part = {k: v for k, v in list_part}
-#             t = ProxyValidate(self, part)
-#             threads.append(t)
-#             t.start()
-#
-#         # 初始化该中间件时,等待有可用的代理
-#         if wait:
-#             while True:
-#                 for t in threads:
-#                     t.join(0.2)
-#                     if self._has_valid_proxy():
-#                         break
-#                 if self._has_valid_proxy():
-#                         break
-#
-#     def _has_valid_proxy(self):
-#         if self.len_valid_proxy() >= self.init_valid_proxys:
-#             return True
-#
-#     def _is_enabled_for_request(self, request):
-#         return self.enable and 'dont_proxy' not in request.meta
-#
-#
-# class ProxyValidate(threading.Thread):
-#     """
-#     测试代理线程类
-#     """
-#
-#     def __init__(self, autoproxy, part):
-#         super(ProxyValidate, self).__init__()
-#         self.autoproxy = autoproxy
-#         self.part = part
-#
-#     def run(self):
-#         self.test_proxyes(self.part)
-#
-#     def test_proxyes(self, proxyes):
-#         for proxy, valid in proxyes.iteritems():
-#             if(self.check_proxy(proxy)):
-#                 self.autoproxy.proxyes[proxy] = True
-#                 self.autoproxy.append_proxy(proxy)
-#
-#     def check_proxy(self, proxy):
-#         proxy_handler = urllib2.ProxyHandler({'http': proxy})
-#         opener = urllib2.build_opener(proxy_handler, urllib2.HTTPHandler)
-#         try:
-#             for url, code in self.autoproxy.test_urls:
-#                 resbody = opener.open(url, timeout=self.autoproxy.test_proxy_timeout).read()
-#                 if code not in resbody:
-#                     return False
-#             return True
-#         except Exception:
-#             return False
-#
-#
-# class ProxyFetch(threading.Thread):
-#
-#     def __init__(self, proxyes, url):
-#         super(ProxyFetch, self).__init__()
-#         self.proxyes = proxyes
-#         self.url = url
-#
-#     def run(self):
-#         self.proxyes.update(getattr(self, 'fetch_proxy_from_' + self.url)())
-#
-#     def fetch_proxy_from_xici(self):
-#         proxyes = {}
-#         url = "http://www.xicidaili.com/nn/"
-#         try:
-#             for i in range(1, 4):
-#                 soup = self.get_soup(url + str(i))
-#                 trs = soup.find("table", attrs={"id": "ip_list"}).find_all("tr")
-#                 for i, tr in enumerate(trs):
-#                     if(0 == i):
-#                         continue
-#                     tds = tr.find_all('td')
-#                     ip = tds[1].text
-#                     port = tds[2].text
-#                     proxy = ''.join(['http://', ip, ':', port]).encode('utf-8')
-#                     proxyes[proxy] = False
-#         except Exception as e:
-#             logger.error('Failed to fetch_proxy_from_xici. Exception[%s]', e)
-#
-#         return proxyes
-#
-#     def fetch_proxy_from_ip3336(self):
-#         proxyes = {}
-#         url = 'http://www.ip3366.net/free/?stype=1&page='
-#         try:
-#             for i in range(1, 6):
-#                 soup = self.get_soup(url + str(i))
-#                 trs = soup.find("div", attrs={"id": "list"}).table.find_all("tr")
-#                 for i, tr in enumerate(trs):
-#                     if 0 == i:
-#                         continue
-#                     tds = tr.find_all("td")
-#                     ip = tds[0].string.strip().encode('utf-8')
-#                     port = tds[1].string.strip().encode('utf-8')
-#                     proxy = ''.join(['http://', ip, ':', port])
-#                     proxyes[proxy] = False
-#         except Exception as e:
-#             logger.error('Failed to fetch_proxy_from_ip3336. Exception[%s]', e)
-#
-#         return proxyes
-#
-#     def fetch_proxy_from_kxdaili(self):
-#         proxyes = {}
-#         url = 'http://www.kxdaili.com/dailiip/1/%d.html'
-#         try:
-#             for i in range(1, 11):
-#                 soup = self.get_soup(url % i)
-#                 trs = soup.find("table", attrs={"class": "ui table segment"}).find_all("tr")
-#                 for i, tr in enumerate(trs):
-#                     if 0 == i:
-#                         continue
-#                     tds = tr.find_all("td")
-#                     ip = tds[0].string.strip().encode('utf-8')
-#                     port = tds[1].string.strip().encode('utf-8')
-#                     proxy = ''.join(['http://', ip, ':', port])
-#                     proxyes[proxy] = False
-#         except Exception as e:
-#             logger.error('Failed to fetch_proxy_from_kxdaili. Exception[%s]', e)
-#
-#         return proxyes
-#
-#     def get_soup(self, url):
-#         request = urllib2.Request(url)
-#         request.add_header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36")
-#         while True:
-#             try:
-#                 html_doc = urllib2.urlopen(request, timeout=30).read()
-#                 break
-#             except:
-#                 logger.info("Fetch proxy from {} fail, will try later.".format(url))
-#                 time.sleep(120)
-#
-#
-#         soup = BeautifulSoup(html_doc)
-#
-#         return soup
-#
-#
-# if __name__ == '__main__':
-#
-#     AutoProxyMiddleware()

+ 0 - 374
scrapy_yzd/scrapy_yzd/items.py

@@ -1,374 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Define here the models for your scraped items
-#
-# See documentation in:
-# http://doc.scrapy.org/en/latest/topics/items.html
-
-import scrapy
-
-
-class ScrapyYzdItem(scrapy.Item):
-    # define the fields for your item here like:
-    # name = scrapy.Field()
-    pass
-
-class Today_all(scrapy.Field):
-    # 让球大小盘
-    concede_size = scrapy.Field()
-# 独赢
-    capot = scrapy.Field()
-# 入球数-单双
-    odd_even = scrapy.Field()
-# 总入球
-    total_goal = scrapy.Field()
-# 半场/全场
-    half_full = scrapy.Field()
-# 波胆
-    bodan = scrapy.Field()
-# 最先/最后进球
-    first_last_ball = scrapy.Field()
-# 冠军
-    champion = scrapy.Field()
-
-    def get_insert_sql(self):
-        insert_sql = """
-              INSERT INTO st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, team, type, source, sole)
-              VALUES (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s)
-            """
-        params = (00000, 'test1111',00000, '2019-04-02 14:04:48', '2019-04-02 14:04:48',0.1,0.16,0,'test','11',0,'h532','2222222333')
-        return  insert_sql, params
-
-
-
-
-
-
-
-class LanqiuItem(scrapy.Item):
-  # 联赛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()
-
-    concede = scrapy.Field()
-    odd_even = scrapy.Field()
-    total_size = scrapy.Field()
-    last_number = scrapy.Field()
-    capot = scrapy.Field()
-    team_score = scrapy.Field()
-
-class Hg3535Item(scrapy.Item):
-    league_id = scrapy.Field() # 联赛id
-    league_name = scrapy.Field() # 联赛名
-    ctn = scrapy.Field() #角球或者其他
-    one_team_name = scrapy.Field() #队一名
-    two_team_name = scrapy.Field() #队二名
-    num = scrapy.Field() # num值
-    date_match = scrapy.Field() # 比赛日期
-    date_time = scrapy.Field() # 比赛时间
-    one_team_score = scrapy.Field() # 队一比分
-    two_team_score = scrapy.Field() # 队二比分
-    half_time =  scrapy.Field() #半场
-    match_id  = scrapy.Field() #比赛id
-    give_ball = scrapy.Field() # ah列表 全场让球
-    full_size = scrapy.Field() # ou列表 全场大小
-    win_situation = scrapy.Field() #1x2列表全场独赢
-    half_handicap = scrapy.Field() # ahlst 上半场让球
-    half_size = scrapy.Field() # oulst 上半场大小
-    half_win = scrapy.Field() # 1x2lst 上半场独赢
-    full_score = scrapy.Field() # oe 全场入球
-    half_goal = scrapy.Field() # oelst 上半场入球
-    total_goal = scrapy.Field() # tg 全场总入球
-    first_half_goal = scrapy.Field() # tglst 上半场总入球
-    half_full_time = scrapy.Field() # hf 半场/全场
-    full_field = scrapy.Field() # cs 全场波胆
-    half_wave = scrapy.Field() # cslst 上半场波胆
-    advanced_ball = scrapy.Field() # ttslast 最先进球
-    final_goal = scrapy.Field()  # tts1st 最后进球
-
-
-
-class DoubanItem(scrapy.Item):
-    movie_name = scrapy.Field()
-    movie_director = scrapy.Field()
-    movie_writer = scrapy.Field()
-    movie_starring = scrapy.Field()
-    movie_category = scrapy.Field()
-    movie_country = scrapy.Field()
-    #movie_language = scrapy.Field()
-    movie_date = scrapy.Field()
-    movie_time = scrapy.Field()
-    movie_star = scrapy.Field()
-    movie_5score = scrapy.Field()
-    movie_4score = scrapy.Field()
-    movie_3score = scrapy.Field()
-    movie_2score = scrapy.Field()
-    movie_1score = scrapy.Field()
-    movie_describe = scrapy.Field()
-    pass
-
-
-class jdItem(scrapy.Item):
-    phone_id = scrapy.Field()
-    phone_name = scrapy.Field()
-    phone_price = scrapy.Field()
-    phone_houdu = scrapy.Field()
-    phone_CPU = scrapy.Field()
-    phone_ROM = scrapy.Field()
-    phone_RAM = scrapy.Field()
-    phone_screen = scrapy.Field()
-    phone_frontcam = scrapy.Field()
-    phone_backcam = scrapy.Field()
-    pass
-
-class SteamItem(scrapy.Item):
-
-    name = scrapy.Field()
-    price = scrapy.Field()
-    release_date = scrapy.Field()
-    metacritic_score = scrapy.Field()
-    user_reviews_count = scrapy.Field()
-    positive_user_reviews_count = scrapy.Field()
-    positive_percent = scrapy.Field()
-    negative_user_reviews_count = scrapy.Field()
-    steam_user_reviews_count = scrapy.Field()
-    non_steam_user_reviews_count = scrapy.Field()
-    english_user_reviews_count = scrapy.Field()
-    non_english_user_reviews_count = scrapy.Field()
-    pass
-
-
-
-class Temaball(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()
-    full_data = scrapy.Field()
-    half_data = scrapy.Field()
-    half_full = scrapy.Field()
-    full_data_rule = scrapy.Field()
-    half_data_rule = scrapy.Field()
-
-
-
-#篮球
-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()
-
-    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 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 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()
-
-
-# 棒球 冠军--------------------------------------------------------------------------------------------------------------
-class Bqguanjun(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()
-    zhuangtai = scrapy.Field()
-    champion = scrapy.Field()
-
-
-# 棒球 联赛--------------------------------------------------------------------------------------------------------------
-class Bangqiuls(scrapy.Field):
-    area_id = scrapy.Field()
-    area_name = scrapy.Field()
-    st_zq_league = scrapy.Field()
-    name_chinese = scrapy.Field()
-
-
-
-class Zuqiustatus(scrapy.Field):
-    match_id = scrapy.Field()
-    create_time = scrapy.Field()
-    status = scrapy.Field()
-    update_time = scrapy.Field()
-    ball_type = scrapy.Field()
-    zuqiu_toal = scrapy.Field()
-
-
-class Bangqiustatus(scrapy.Field):
-    match_id = scrapy.Field()
-    create_time = scrapy.Field()
-    status = scrapy.Field()
-    update_time = scrapy.Field()
-    ball_type = scrapy.Field()
-    zuqiu_toal = scrapy.Field()
-
-
-
-class Lanqiustatus(scrapy.Field):
-    match_id = scrapy.Field()
-    create_time = scrapy.Field()
-    status = scrapy.Field()
-    update_time = scrapy.Field()
-    ball_type = scrapy.Field()
-    zuqiu_toal = scrapy.Field()
-
-
-class Wanqiustatus(scrapy.Field):
-    match_id = scrapy.Field()
-    create_time = scrapy.Field()
-    status = scrapy.Field()
-    update_time = scrapy.Field()
-    ball_type = scrapy.Field()
-    zuqiu_toal = scrapy.Field()

+ 0 - 53
scrapy_yzd/scrapy_yzd/middlewares.py

@@ -1,53 +0,0 @@
-# -*-coding:utf-8-*-
-import random
-from scrapy.downloadermiddlewares.useragent import UserAgentMiddleware
-
-import base64
-
-
-class ProxyMiddleware(object):  # 该为指定代理,暂未使用
-    # overwrite process request
-    def process_request(self, request, spider):
-        # Set the location of the proxy
-        request.meta['proxy'] = "http://110.157.171.11:9000"
-        print('-------------------------Trying to use proxy----------------------------')
-        # Use the following lines if your proxy requires authentication
-        proxy_user_pass = "USERNAME:PASSWORD"
-        # setup basic authentication for the proxy
-        encoded_user_pass = base64.encodestring(proxy_user_pass)
-        request.headers['Proxy-Authorization'] = 'Basic ' + encoded_user_pass
-
-
-class RotateUserAgentMiddleware(UserAgentMiddleware):  #轮换代理agent
-    def __init__(self, user_agent=''):
-        self.user_agent = user_agent
-
-    def process_request(self, request, spider):
-        ua = random.choice(self.user_agent_list)
-        if ua:
-            #print '-----------------------Using user-agent:', ua, '------------------------'
-            request.headers.setdefault('User-Agent', ua)
-
-            # the default user_agent_list composes chrome,I E,firefox,Mozilla,opera,netscape
-
-    # for more user agent strings,you can find it in http://www.useragentstring.com/pages/useragentstring.php
-    user_agent_list = [ \
-        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1" \
-        "Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11", \
-        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6", \
-        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6", \
-        "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/19.77.34.5 Safari/537.1", \
-        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5", \
-        "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.36 Safari/536.5", \
-        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3", \
-        "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3", \
-        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3", \
-        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3", \
-        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3", \
-        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3", \
-        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3", \
-        "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3", \
-        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.0 Safari/536.3", \
-        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24", \
-        "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24"
-    ]

+ 0 - 3569
scrapy_yzd/scrapy_yzd/pipelines.py

@@ -1,3569 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Define your item pipelines here
-#
-# Don't forget to add your pipeline to the ITEM_PIPELINES setting
-# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
-# from psycopg2._psycopg import IntegrityError
-# from peewee import IntegrityError
-from twisted.enterprise import adbapi
-import datetime
-from models import database, StZqOdds,StZqResultRecord,StZqResult,StZqCompetition,StZqOddsRecord
-import time
-import hashlib
-import json
-# StZqResult
-
-import psycopg2
-
-import psycopg2.extras
-
-# conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-# database = PostgresqlDatabase('postgres', **{'host': '127.0.0.1', 'port': 5432, 'user': 'postgres', 'password': '9998877'})
-
-# conn = psycopg2.connect(host='127.0.0.1', port=5432, user='postgres', password='9998877', database='postgres')
-from scrapy_yzd.items import Bangqiustatus, Lanqiustatus, Wanqiustatus,Zuqiustatus
-
-
-#生成odds_only哈希  pt不需要
-def r_func(match_id, odds_code, sort, p_id, odd):
-    m = hashlib.md5()
-    a = str(match_id) + str(odds_code) + str(sort) + str(p_id)  + str(odd)
-    m.update(a.encode('utf-8'))
-    c = m.hexdigest()
-    return c
-
-
-def inset_odd(match_id,value,utime,ctime,condition,p_id,wanfa):
-    if StZqOdds.filter(match_id=match_id):
-        for k, v in value.items():
-            st_zq_odd = StZqOdds.filter(match_id=match_id, odds_code=k,p_code=wanfa)
-            if st_zq_odd:
-                if v:
-                    StZqOdds.update(utime=utime, odds=v).where(StZqOdds.match_id == match_id,
-                                                                 StZqOdds.odds_code == k).execute()
-            else:
-                if v:
-                    StZqOdds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
-                                      condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,odds_code=k)
-    else:
-        for k, v in value.items():
-            if v:
-                StZqOdds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
-                                  condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
-                                  odds_code=k)
-    # for k, v in value.items():
-        # if v:
-            # StZqOddsRecord.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
-            #                          condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
-            #                          odds_code=k)
-
-
-# pt=4
-def hash_func(match_id, odds_code, sort, p_id):
-    m = hashlib.md5()
-    a = str(match_id) + str(odds_code) + str(sort) + str(p_id)
-    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)
-    data_time = str(time3).split(" ")
-    match_date = data_time[0]
-    match_time = data_time[1]
-    return match_date,match_time
-
-
-
-class ScrapyYzdPipeline(object):
-    #采用同步的机制写入pg
-    def __init__(self):
-        self.conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        # self.conn = database
-        # self.cursor = self.conn.cursor()
-
-    def process_item(self, item, spider):
-        # print(item)
-        a = (dict(item))
-        # a = (dict(item))
-        # print(a)
-        #大小
-        concede_sizes = item.get('concede_size', "")
-        # print(concede_sizes)
-        if concede_sizes:
-            with database.atomic():
-                #key 联赛id
-                for key, value in concede_sizes.items():
-                    # 比赛日期
-                    data_game = value.pop('data_game').split("/")
-                    month = str(data_game[1].strip())
-                    day = str(data_game[0])
-                    # 比赛时间
-                    time_game = str(value.pop('time_game'))
-                    # 比赛时间,时间戳
-                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
-                    # match_date,match_time = new_time(ctime)
-                    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))#过期时间
-                    print(type(expire_time))
-                    # 比赛id
-                    competition_id = value.pop('game_id')
-                    # 联赛id
-                    league_id = value.pop('league_id')
-                    # 联赛name
-                    league_name = value.pop('league_name')
-                    # 主队
-                    team_home = value.pop('team_home')
-                    # 客队
-                    team_guest = value.pop('team_guest')
-                    # 主队得分
-                    score_home = value.pop('score_home')  # match_score
-                    # 客队得分
-                    score_guest = value.pop('score_guest') # match_score  这两个字段要按数据库定义格式存入对应字段
-                    score_status  =  value.get('status','')#比赛状态
-                    if score_status == "True":
-                        score_status = 1
-                    else:
-                        score_status = 0
-
-                    # 全场让球
-                    # number
-                    number = value.pop('number')
-                    corner_ball = value.pop('corner_ball')#角球
-                    half_way = value.get('half_way',"")
-                    concede_home = value.get('concede_home', "")
-                    concede_home_rule = value.get('concede_home_rule', "")
-                    concede_guest = value.get("concede_guest", "")
-                    concede_guest_rule = value.get("concede_guest_rule", "")
-                    # 上半场让球
-                    half_concede_home = value.get("half_concede_home", "")
-                    half_concede_home_rule = value.get("half_concede_home_rule", "")
-                    half_concede_guest = value.get("half_concede_guest", "")
-                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-                    # 全场大小
-                    size_home = value.get('size_home')
-                    size_home_rule = value.get('size_home')
-                    size_guest = value.get('size_guest')
-                    size_guest_rule = value.get('size_guest_rule', "")
-                    # 上半场大小
-                    half_size_home = value.get('half_size_home', "")
-                    half_size_home_rule = value.get('half_size_home_rule', "")
-                    half_size_guest = value.get('half_size_guset', "")
-                    half_size_guest_rule = value.get('half_size_guest_rule', "")
-                    match_score = "{}:{}".format(score_home,score_guest)
-
-                    # 如果角球存在
-                    # if corner_ball:
-                    #     wanfa = corner_ball
-                    #     p_id = 9
-                    # else:
-                    #     wanfa = "concede_size"
-                    #     p_id = 1
-
-                    #如果角球存在
-                    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 = "concede_size"
-                        p_id = 1
-
-                    if StZqResult.filter(match_id=key):
-                        StZqResult.update(update_time=utime,match_score=match_score,match_time=time_game,match_process=half_way,home_score=score_home,guest_score=score_guest).where(StZqResult.match_id == key).execute()
-                    else:
-                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535',p_code=p_code)
-
-                    #全场让球条件
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            # odds_only = new_hash + str(time.time())  # 赔率更新记录
-                            odds_only = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,is_rollball=1,
-                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
-                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
-
-
-                    if concede_guest:
-                        for index, result in enumerate(concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            # odds_only = new_hash + str(time.time())  # 赔率更新记录
-                            odds_only = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
-
-
-                    if half_concede_guest:
-                        for index, result in enumerate(half_concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            # odds_only = new_hash + str(time.time())  # 赔率更新记录
-                            odds_only = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,lg_id=league_id,odds_only=odds_only,
-                                                      source='hg3535',expire_time=expire_time,is_rollball=1,
-                                                      max=half_concede_guest[index],
-                                                      condition=half_concede_guest_rule[index],
-                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
-
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            # odds_only = new_hash + str(time.time())  # 赔率更新记录
-                            odds_only = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,is_rollball=1,
-                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
-                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
-
-
-
-                    if size_guest:
-                        for index, result in enumerate(size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=size_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-
-
-
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_size_guest_rule[index]).where(StZqOdds.sole==new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
-
-                    #赔率插入记录表
-
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
-                                                     condition=concede_guest_rule[index], odds=concede_guest[index],odds_only= odds_only2,
-                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',is_rollball=1,
-                                                     odds_code="concede_guest",sole=new_hash2)
-
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,is_rollball=1,
-                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,odds_only= odds_only1,
-                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime,lg_id=league_id,
-                                                     max=half_concede_guest[index],source='hg3535',odds_only = odds_only2,
-                                                     condition=half_concede_guest_rule[index],
-                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,is_rollball=1,
-                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,is_rollball=1,
-                                                     condition=size_home_rule[index], odds=result, p_id=p_id,odds_only= odds_only1,
-                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,is_rollball=1,
-                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,odds_only = odds_only2,
-                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',odds_only=odds_only,is_rollball=1,
-                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,lg_id=league_id,
-                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],odds_only=odds_only,is_rollball=1,
-                                                     p_id=p_id, p_code=p_code, sort=index,
-                                                     odds_code="half_size_guest",sole=new_hash)
-
-
-
-
-
-
-
-                    #赛事表
-                    if StZqCompetition.filter(match_id=key):
-                        StZqCompetition.update(utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
-                    else:
-                        StZqCompetition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,expire_time=expire_time,us_time='2019-01-01 00:00:00')
-
-
-
-
-                    #更新记录表 具体更新哪些值目前随便写未知
-                    # if StZqResultRecord.filter(match_id=key):
-                    #     StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score,match_process=half_way).where(StZqResultRecord.match_id == key).execute()
-                    # else:
-                    StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,match_id=key,source='hg3535',p_code=p_code)
-
-
-
-
-
-
-
-                        # for k, v in value.items():
-                        #     if v:
-                        #         for index, result in enumerate(v):
-                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-                        #             if st_zq_odd:
-                        #                 if result:
-                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
-                        #             else:
-                        #                 if result:
-                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-                    # else:
-                    #     for k, v in value.items():
-                    #         if v:
-                    #             for index, result in enumerate(v):
-                    #                 if result:
-                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
-
-
-        capot = item.get('capot', "")
-        # print(capot)
-        if capot:
-            with database.atomic():
-                #key 联赛id
-                for key, value in capot.items():
-                    data_game = value.pop('data_game')
-                    month = str(data_game[1].strip())
-                    day = str(data_game[0])
-                    # 比赛时间
-                    time_game = str(value.pop('time_game'))
-                    # 比赛时间,时间戳
-                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
-                    # match_date,match_time = new_time(ctime)
-                    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 = value.pop('game_id')
-                    # 联赛id
-                    league_id = value.pop('league_id')
-                    # 联赛name
-                    league_name = value.pop('league_name')
-                    # 主队
-                    team_home = value.pop('team_home')
-                    # 客队
-                    team_guest = value.pop('team_guest')
-                    # 主队得分
-                    score_home = value.pop('score_home')
-                    # 客队得分
-                    score_guest = value.pop('score_guest')
-                    # 全场让球
-                    # number
-                    number = value.pop('number')
-                    corner_ball = value.pop('corner_ball')
-                    half_way = value.pop('half_way')
-                    concede_home = value.get('concede_home', "")
-                    concede_home_rule = value.get('concede_home_rule', "")
-                    concede_guest = value.get("concede_guest", "")
-                    concede_guest_rule = value.get("concede_guest_rule", "")
-                    # 上半场让球
-                    half_concede_home = value.get("half_concede_home", "")
-                    half_concede_home_rule = value.get("half_concede_home_rule", "")
-                    half_concede_guest = value.get("half_concede_guest", "")
-                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-                    # 全场大小
-                    size_home = value.get('size_home')
-                    size_home_rule = value.get('size_home')
-                    size_guest = value.get('size_guest')
-                    size_guest_rule = value.get('size_guest_rule', "")
-                    # 上半场大小
-                    half_size_home = value.get('half_size_home', "")
-                    half_size_home_rule = value.get('half_size_home_rule', "")
-                    half_size_guest = value.get('half_size_guset', "")
-                    half_size_guest_rule = value.get('half_size_guest_rule', "")
-                    score_status  =  value.get('status','')
-                    if score_status == "True":
-                        score_status = 1
-                    else:
-                        score_status = 0
-
-                    match_score = "{}:{}".format(score_home,score_guest)
-
-
-
-
-
-                    #如果角球存在
-                    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 = "capot"
-                        p_id = 2
-
-                    if StZqResult.filter(match_id=key):
-                        StZqResult.update(match_score=match_score,update_time=utime,match_time=time_game,match_process=half_way,home_score=score_home,guest_score=score_guest).where(StZqResult.match_id == key).execute()
-                    else:
-                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535',p_code=p_code)
-
-
-
-                    #全场让球条件
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
-
-
-                    if concede_guest:
-                        for index, result in enumerate(concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
-
-
-                    if half_concede_guest:
-                        for index, result in enumerate(half_concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                      max=half_concede_guest[index],expire_time=expire_time,is_rollball=1,
-                                                      condition=half_concede_guest_rule[index],
-                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
-
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
-
-
-
-                    if size_guest:
-                        for index, result in enumerate(size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=size_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-
-
-
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_size_guest_rule[index]).where(StZqOdds.sole==new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
-                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
-
-                    #赔率插入记录表
-
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=concede_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=concede_guest_rule[index], odds=concede_guest[index],is_rollball=1,
-                                                     p_id=p_id, p_code=p_code, sort=index,odds_only=odds_only2,
-                                                     odds_code="concede_guest",sole=new_hash2)
-
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,is_rollball=1,
-                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,
-                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
-                                                     max=half_concede_guest[index],odds_only=odds_only2,
-                                                     condition=half_concede_guest_rule[index],is_rollball=1,
-                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=size_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,odds_only=odds_only2,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',odds_only=odds_only,
-                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],lg_id=league_id,is_rollball=1,
-                                                     p_id=p_id, p_code=p_code, sort=index,
-                                                     odds_code="half_size_guest",sole=new_hash)
-
-
-
-
-                    #赛事表
-                    if StZqCompetition.filter(match_id=key):
-                        StZqCompetition.update(utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
-                    else:
-                        StZqCompetition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,expire_time=expire_time,us_time='2019-01-01 00:00:00')
-
-
-                    #更新记录表 具体更新哪些值目前随便写未知
-                    # if StZqResultRecord.filter(match_id=key):
-                    #     StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score,match_time=time_game).where(StZqResultRecord.match_id == key).execute()
-                    # else:
-                    StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,match_id=key,source='hg3535',p_code=p_code)
-
-
-
-                        # for k, v in value.items():
-                        #     if v:
-                        #         for index, result in enumerate(v):
-                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-                        #             if st_zq_odd:
-                        #                 if result:
-                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
-                        #             else:
-                        #                 if result:
-                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-                    # else:
-                    #     for k, v in value.items():
-                    #         if v:
-                    #             for index, result in enumerate(v):
-                    #                 if result:
-                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
-
-        #入球数
-        odd_even = item.get('odd_even', "")
-        if odd_even:
-            with database.atomic():
-                #key 联赛id
-                for key, value in odd_even.items():
-                    # 比赛日期
-                    data_game = value.pop('data_game').split("/")
-                    month = str(data_game[1].strip())
-                    day = str(data_game[0])
-                    # 比赛时间
-                    time_game = str(value.pop('time_game'))
-                    # 比赛时间,时间戳
-                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
-                    # match_date,match_time = new_time(ctime)
-                    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 = value.pop('game_id')
-                    # 联赛id
-                    league_id = value.pop('league_id')
-
-                    #全场单
-                    odd_even_odd = value.get("odd_even_odd", "")
-                    #全场双
-                    odd_even_even = value.get("odd_even_even", "")
-
-                    #上半场单
-                    half_odd_even_odd = value.get("half_odd_even_odd","")
-
-                    #上半场双
-                    half_odd_even_even = value.get("half_odd_even_even", "")
-
-
-                    # 联赛name
-                    league_name = value.pop('league_name')
-                    # 主队
-                    team_home = value.pop('team_home')
-                    # 客队
-                    team_guest = value.pop('team_guest')
-                    # 主队得分
-                    score_home = value.pop('score_home')
-                    # 客队得分
-                    score_guest = value.pop('score_guest')
-                    # 全场让球
-                    # number
-                    number = value.pop('number')
-                    corner_ball = value.pop('corner_ball')
-                    half_way = value.pop('half_way')
-                    concede_home = value.get('concede_home', "")
-                    concede_home_rule = value.get('concede_home_rule', "")
-                    concede_guest = value.get("concede_guest", "")
-                    concede_guest_rule = value.get("concede_guest_rule", "")
-                    # 上半场让球
-                    half_concede_home = value.get("half_concede_home", "")
-                    half_concede_home_rule = value.get("half_concede_home_rule", "")
-                    half_concede_guest = value.get("half_concede_guest", "")
-                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-                    # 全场大小
-                    size_home = value.get('size_home')
-                    size_home_rule = value.get('size_home')
-                    size_guest = value.get('size_guest')
-                    size_guest_rule = value.get('size_guest_rule', "")
-                    # 上半场大小
-                    half_size_home = value.get('half_size_home', "")
-                    half_size_home_rule = value.get('half_size_home_rule', "")
-                    half_size_guest = value.get('half_size_guset', "")
-                    half_size_guest_rule = value.get('half_size_guest_rule', "")
-                    score_status  =  value.pop('status')#比赛状态
-                    if score_status == "True":
-                        score_status = 1
-                    else:
-                        score_status = 0
-
-                    match_score = "{}:{}".format(score_home,score_guest)
-
-
-
-                    #如果角球存在
-                    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 = "two_sides"
-                        p_id = 3
-
-                    if StZqResult.filter(match_id=key):
-                        StZqResult.update(update_time=utime,match_score=match_score,match_time=time_game,match_process=half_way,home_score=score_home,guest_score=score_guest).where(StZqResult.match_id == key).execute()
-                    else:
-                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535',p_code=p_code)
-
-
-                        #odd even 单   另外的是刷过 改condition 条件为 double
-                    if odd_even_odd:
-                        for index, result in enumerate(odd_even_odd):
-                            new_hash = hash_func(match_id=key, odds_code="one_sides_single", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="one_sides_single", sort=index, p_id=p_id,odd=result)
-                            #更新赔率记录表
-                            if result == '.':
-                                result = 0
-                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="one_sides_single",match_id=key,ctime=utime,utime=utime,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="单",is_rollball=1)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:  #sort的值?
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition="单").where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,source='hg3535',expire_time=expire_time,odds_only=odds_only,
-                                                          condition="单", odds=result, p_id=p_id,lg_id=league_id,odds_code="two_sides_single",
-                                                          p_code=p_code, sort=index,sole=new_hash,is_rollball=1)
-
-
-
-
-
-                        #双
-                    if odd_even_even:
-                        for index,result in enumerate(odd_even_even):
-                            new_hash = hash_func(match_id=key, odds_code="two_sides_double", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="two_sides_double", sort=index, p_id=p_id,odd=result)
-                            #更新赔率记录表
-                            if result == '.':
-                                result = 0
-                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="two_sides_double",match_id=key,ctime=utime,utime=utime,max=result,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="双",is_rollball=1)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition="双").where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',expire_time=expire_time,
-                                                          condition="双", odds=result, p_id=p_id,lg_id=league_id,odds_code="two_sides_double",
-                                                          p_code=p_code, sort=index,sole=new_hash,odds_only=odds_only,is_rollball=1)
-
-
-                       #上半场单
-                    if half_odd_even_odd:
-                        for index,result in enumerate(half_odd_even_odd):
-                            new_hash = hash_func(match_id=key, odds_code="half_two_sides_single", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_two_sides_single", sort=index, p_id=p_id,odd=result)
-                            if result == '.':
-                                result = 0
-                            #更新赔率记录表
-                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="half_two_sides_single",match_id=key,ctime=utime,utime=utime,max=result,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="单",is_rollball=1)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result, expire_time=expire_time,condition="单").where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key,ctime=utime, utime=utime,max=result,source='hg3535',expire_time=expire_time,
-                                                        condition="单", odds=result, p_id=p_id,lg_id=league_id,odds_code="half_two_sides_single",
-                                                          p_code=p_code, sort=index,sole=new_hash,is_rollball=1)
-
-
-
-                    #上半场双
-                    if half_odd_even_even:
-                        for index,result in enumerate(half_odd_even_even):
-                            new_hash = hash_func(match_id=key, odds_code="half_two_sides_double", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_two_sides_double", sort=index, p_id=p_id,odd=result)
-                            #更新赔率记录表
-                            if result == '.':
-                                result = 0
-                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="half_two_sides_double",match_id=key,ctime=utime,utime=utime,max=result,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="双",is_rollball=1)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result, expire_time=expire_time,condition="双").where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key,ctime=utime, utime=utime,max=result,source='hg3535',expire_time=expire_time,
-                                                        condition="双", odds=result, p_id=p_id,lg_id=league_id,odds_code="half_two_sides_double",
-                                                          p_code=p_code, sort=index,sole=new_hash,is_rollball=1)
-
-
-
-
-
-
-
-
-
-
-
-                    # 全场入球数 单双
-                    # if odd_even_odd:
-                    #     # 构建唯一索引
-                    #     new_hash = hash_func(match_id=competition_id, odds_code="two_sides_single", sort=0, p_id=p_id)
-                    #     # 更新主队st_zq_odds表
-                    #     odd_even_odd_sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values ( %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s)on conflict(sole) do update set utime = %s,odds = %s;"
-                    #     cursor.execute(odd_even_odd_sql1, (
-                    #         int(league_id), "two_sides_single", int(competition_id), utime, utime, odd_even_odd, odd_even_odd, p_id,
-                    #         p_code, 0, "hg3535", new_hash, "single", utime, odd_even_odd))
-                    #     # 更新主队st_zq_odds_record表
-                    #     odd_even_odd_sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
-                    #     cursor.execute(odd_even_odd_sql2, (
-                    #         int(league_id), "two_sides_single", int(competition_id), utime, utime, odd_even_odd, odd_even_odd, p_id,
-                    #         p_code, 0, "hg3535", "single"))
-                    #
-                    #     new_hash1 = hash_func(match_id=competition_id, odds_code="two_sides_double", sort=0, p_id=p_id)
-                    #     # 更新主队st_zq_odds表
-                    #     odd_even_even_sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s)on conflict(sole) do update set utime = %s,odds = %s;"
-                    #     cursor.execute(odd_even_odd_sql1, (
-                    #         int(league_id), "two_sides_double", int(competition_id), utime, utime, odd_even_even, odd_even_even, p_id,
-                    #         p_code, 0, "hg3535", new_hash1, "double", utime, odd_even_even))
-                    #     # 更新主队st_zq_odds_record表
-                    #     odd_even_even_sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
-                    #     cursor.execute(odd_even_odd_sql2, (
-                    #         int(league_id), "two_sides_double", int(competition_id), utime, utime, odd_even_even, odd_even_even, p_id,
-                    #         p_code, 0, "hg3535", "double"))
-
-
-
-
-                    #全场让球条件
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',expire_time=expire_time,
-                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,lg_id=league_id,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
-
-
-                    if concede_guest:
-                        for index, result in enumerate(concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
-
-
-                    if half_concede_guest:
-                        for index, result in enumerate(half_concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
-                                                      max=half_concede_guest[index],expire_time=expire_time,odds_only=odds_only,
-                                                      condition=half_concede_guest_rule[index],is_rollball=1,
-                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
-
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
-
-
-
-                    if size_guest:
-                        for index, result in enumerate(size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-
-
-
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only,condition=half_size_guest_rule[index]).where(StZqOdds.sole==new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
-
-                    #赔率插入记录表
-
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',
-                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only= odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,is_rollball=1,
-                                                     odds_code="concede_guest",sole=new_hash2)
-
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,lg_id=league_id,
-                                                     max=half_concede_guest[index],is_rollball=1,
-                                                     source='hg3535',
-                                                     condition=half_concede_guest_rule[index],
-                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-
-                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],lg_id=league_id,
-                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',is_rollball=1,
-                                                     odds_code="half_size_guest",sole=new_hash)
-
-
-
-
-
-
-                    #赛事表
-                    if StZqCompetition.filter(match_id=key):
-                        StZqCompetition.update(expire_time= expire_time,utime=utime,status=score_status,tag=number).where(StZqCompetition.match_id == key).execute()
-                    else:
-                        StZqCompetition.create(expire_time= expire_time,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,us_time='2019-01-01 00:00:00')
-
-
-                    # #更新记录表 具体更新哪些值目前随便写未知
-                    # if StZqResultRecord.filter(match_id=key):
-                    #  StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score,match_time=time_game).where(StZqResultRecord.match_id == key).execute()
-                    # else:
-                    StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,match_id=key,source='hg3535',p_code=p_code)
-
-
-
-
-
-
-                        # for k, v in value.items():
-                        #     if v:
-                        #         for index, result in enumerate(v):
-                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-                        #             if st_zq_odd:
-                        #                 if result:
-                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
-                        #             else:
-                        #                 if result:
-                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-                    # else:
-                    #     for k, v in value.items():
-                    #         if v:
-                    #             for index, result in enumerate(v):
-                    #                 if result:
-                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
-
-        total_goal = item.get('total_goal', "")
-        if total_goal:
-            with database.atomic():
-                #key 联赛id
-                for key, value in total_goal.items():
-                    # 比赛日期
-                    data_game = value.pop('data_game').split("/")
-                    month = str(data_game[1].strip())
-                    day = str(data_game[0])
-                    # 比赛时间
-                    time_game = str(value.pop('time_game'))
-                    # 比赛时间,时间戳
-                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
-                    # match_date,match_time = new_time(ctime)
-                    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 = value.pop('game_id')
-                    # 联赛id
-                    league_id = value.pop('league_id')
-                    # 联赛name
-                    league_name = value.pop('league_name')
-                    # 主队
-                    team_home = value.pop('team_home')
-                    # 客队
-                    team_guest = value.pop('team_guest')
-                    # 主队得分
-                    score_home = value.pop('score_home')
-                    # 客队得分
-                    score_guest = value.pop('score_guest')
-                    # 全场让球
-                    # number
-                    number = value.pop('number')
-                    corner_ball = value.pop('corner_ball')
-                    half_way = value.pop('half_way')
-                    concede_home = value.get('concede_home', "")
-                    concede_home_rule = value.get('concede_home_rule', "")
-                    concede_guest = value.get("concede_guest", "")
-                    concede_guest_rule = value.get("concede_guest_rule", "")
-                    # 上半场让球
-                    half_concede_home = value.get("half_concede_home", "")
-                    half_concede_home_rule = value.get("half_concede_home_rule", "")
-                    half_concede_guest = value.get("half_concede_guest", "")
-                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-                    # 全场大小
-                    size_home = value.get('size_home')
-                    size_home_rule = value.get('size_home')
-                    size_guest = value.get('size_guest')
-                    size_guest_rule = value.get('size_guest_rule', "")
-                    # 上半场大小
-                    half_size_home = value.get('half_size_home', "")
-                    half_size_home_rule = value.get('half_size_home_rule', "")
-                    half_size_guest = value.get('half_size_guset', "")
-                    half_size_guest_rule = value.get('half_size_guest_rule', "")
-                    score_status  =  value.get('status',"")#比赛状态
-
-                    if score_status == "True":
-                        score_status = 1
-                    else:
-                        score_status = 0
-
-                    match_score = "{}:{}".format(score_home,score_guest)
-
-
-
-
-                    #如果角球存在
-                    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 = "two_sides"
-                        p_id = 4
-
-                    if StZqResult.filter(match_id=key):
-                        StZqResult.update(update_time=utime,match_score=match_score,match_time=time_game,match_process=half_way,home_score=score_home,guest_score=score_guest).where(StZqResult.match_id == key).execute()
-                    else:
-                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535',p_code=p_code)
-
-                    #全场让球条件
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
-
-
-                    if concede_guest:
-                        for index, result in enumerate(concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
-
-
-                    if half_concede_guest:
-                        for index, result in enumerate(half_concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,lg_id=league_id,expire_time=expire_time,
-                                                      source='hg3535',is_rollball=1,
-                                                      max=half_concede_guest[index],
-                                                      condition=half_concede_guest_rule[index],
-                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
-
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
-
-
-
-                    if size_guest:
-                        for index, result in enumerate(size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-
-
-
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_guest_rule[index]).where(StZqOdds.sole==new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
-
-                    #赔率插入记录表
-
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
-                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',is_rollball=1,
-                                                     odds_code="concede_guest",sole=new_hash2)
-
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
-                                                     max=half_concede_guest[index],is_rollball=1,
-                                                     condition=half_concede_guest_rule[index],
-                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',
-                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,lg_id=league_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],lg_id=league_id,
-                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',is_rollball=1,
-                                                     odds_code="half_size_guest",sole=new_hash)
-
-
-
-
-                    #赛事表
-                    if StZqCompetition.filter(match_id=key):
-                        StZqCompetition.update(is_rollball=1,utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
-                    else:
-                        StZqCompetition.create(is_rollball=1,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,expire_time=expire_time,us_time='2019-01-01 00:00:00')
-
-
-                    #更新记录表 具体更新哪些值目前随便写未知
-                    # if StZqResultRecord.filter(match_id=key):
-                    #     StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score,match_time=time_game).where(StZqResultRecord.match_id == key).execute()
-                    # else:
-                    StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,match_id=key,source='hg3535',p_code=p_code)
-
-
-
-
-
-
-                        # for k, v in value.items():
-                        #     if v:
-                        #         for index, result in enumerate(v):
-                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-                        #             if st_zq_odd:
-                        #                 if result:
-                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
-                        #             else:
-                        #                 if result:
-                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-                    # else:
-                    #     for k, v in value.items():
-                    #         if v:
-                    #             for index, result in enumerate(v):
-                    #                 if result:
-                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
-
-        half_full = item.get('half_full', "")
-        if half_full:
-            with database.atomic():
-                #key 联赛id
-                for key, value in half_full.items():
-                    # 比赛日期
-                    data_game = value.pop('data_game').split("/")
-                    month = str(data_game[1].strip())
-                    day = str(data_game[0])
-                    # 比赛时间
-                    time_game = str(value.pop('time_game'))
-                    # 比赛时间,时间戳
-                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
-                    # match_date,match_time = new_time(ctime)
-                    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 = value.pop('game_id')
-                    # 联赛id
-                    league_id = value.pop('league_id')
-                    # 联赛name
-                    league_name = value.pop('league_name')
-                    # 主队
-                    team_home = value.pop('team_home')
-                    # 客队
-                    team_guest = value.pop('team_guest')
-                    # 主队得分
-                    score_home = value.pop('score_home')
-                    # 客队得分
-                    score_guest = value.pop('score_guest')
-                    # 全场让球
-                    # number
-                    number = value.pop('number')
-                    corner_ball = value.pop('corner_ball')
-                    half_way = value.pop('half_way')
-                    concede_home = value.get('concede_home', "")
-                    concede_home_rule = value.get('concede_home_rule', "")
-                    concede_guest = value.get("concede_guest", "")
-                    concede_guest_rule = value.get("concede_guest_rule", "")
-                    # 上半场让球
-                    half_concede_home = value.get("half_concede_home", "")
-                    half_concede_home_rule = value.get("half_concede_home_rule", "")
-                    half_concede_guest = value.get("half_concede_guest", "")
-                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-                    # 全场大小
-                    size_home = value.get('size_home')
-                    size_home_rule = value.get('size_home')
-                    size_guest = value.get('size_guest')
-                    size_guest_rule = value.get('size_guest_rule', "")
-                    # 上半场大小
-                    half_size_home = value.get('half_size_home', "")
-                    half_size_home_rule = value.get('half_size_home_rule', "")
-                    half_size_guest = value.get('half_size_guset', "")
-                    half_size_guest_rule = value.get('half_size_guest_rule', "")
-                    score_status  =  value.get('status','')#比赛状态
-                    if score_status == "True":
-                        score_status = 1
-                    else:
-                        score_status = 0
-
-                    match_score = "{}:{}".format(score_home,score_guest)
-
-
-
-
-                    #如果角球存在
-                    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 = "two_sides"
-                        p_id = 5
-
-                    if StZqResult.filter(match_id=key):
-                        StZqResult.update(update_time=utime,match_score=match_score,match_time=time_game,match_process=half_way,home_score=score_home,guest_score=score_guest).where(StZqResult.match_id == key).execute()
-                    else:
-                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535',p_code=p_code)
-
-
-                    #全场让球条件
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,pt=4)
-                            odds_only = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,pt=4,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
-
-
-                    if concede_guest:
-                        for index, result in enumerate(concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
-
-
-                    if half_concede_guest:
-                        for index, result in enumerate(half_concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,expire_time=expire_time,
-                                                      max=half_concede_guest[index],is_rollball=1,
-                                                      condition=half_concede_guest_rule[index],
-                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
-
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,expire_time=expire_time,
-                                                      condition=size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
-
-
-
-                    if size_guest:
-                        for index, result in enumerate(size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-
-
-
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_guest_rule[index]).where(StZqOdds.sole==new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
-
-                    #赔率插入记录表
-
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',
-                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
-                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',is_rollball=1,
-                                                     odds_code="concede_guest",sole=new_hash2)
-
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,lg_id=league_id,
-                                                     max=half_concede_guest[index],source='hg3535',is_rollball=1,
-                                                     condition=half_concede_guest_rule[index],
-                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],lg_id=league_id,
-                                                     source='hg3535',is_rollball=1,
-                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,
-                                                     odds_code="half_size_guest",sole=new_hash)
-
-
-
-
-                    #赛事表
-                    if StZqCompetition.filter(match_id=key):
-                        StZqCompetition.update(is_rollball=1,utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
-                    else:
-                        StZqCompetition.create(is_rollball=1,expire_time=expire_time,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,us_time='2019-01-01 00:00:00')
-
-
-                    # #更新记录表 具体更新哪些值目前随便写未知
-                    # if StZqResultRecord.filter(match_id=key):
-                    #     StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score,match_time=time_game).where(StZqResultRecord.match_id == key).execute()
-                    # else:
-                    StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,match_id=key,source='hg3535',p_code=p_code)
-
-
-
-
-
-
-                        # for k, v in value.items():
-                        #     if v:
-                        #         for index, result in enumerate(v):
-                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-                        #             if st_zq_odd:
-                        #                 if result:
-                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
-                        #             else:
-                        #                 if result:
-                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-                    # else:
-                    #     for k, v in value.items():
-                    #         if v:
-                    #             for index, result in enumerate(v):
-                    #                 if result:
-                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
-
-        bodan = item.get('bodan', "")
-        if bodan:
-            with database.atomic():
-                #key 联赛id
-                for key, value in bodan.items():
-                    # 比赛日期
-                    data_game = value.pop('data_game').split("/")
-                    month = str(data_game[1].strip())
-                    day = str(data_game[0])
-                    # 比赛时间
-                    time_game = str(value.pop('time_game'))
-                    # 比赛时间,时间戳
-                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
-                    # match_date,match_time = new_time(ctime)
-                    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 = value.pop('game_id')
-                    # 联赛id
-                    league_id = value.pop('league_id')
-                    # 联赛name
-                    league_name = value.pop('league_name')
-                    # 主队
-                    team_home = value.pop('team_home')
-                    # 客队
-                    team_guest = value.pop('team_guest')
-                    # 主队得分
-                    score_home = value.pop('score_home')
-                    # 客队得分
-                    score_guest = value.pop('score_guest')
-                    # 全场让球
-                    # number
-                    number = value.pop('number')
-                    corner_ball = value.pop('corner_ball')
-                    half_way = value.pop('half_way')
-                    concede_home = value.get('concede_home', "")
-                    concede_home_rule = value.get('concede_home_rule', "")
-                    concede_guest = value.get("concede_guest", "")
-                    concede_guest_rule = value.get("concede_guest_rule", "")
-                    # 上半场让球
-                    half_concede_home = value.get("half_concede_home", "")
-                    half_concede_home_rule = value.get("half_concede_home_rule", "")
-                    half_concede_guest = value.get("half_concede_guest", "")
-                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-                    # 全场大小
-                    size_home = value.get('size_home')
-                    size_home_rule = value.get('size_home')
-                    size_guest = value.get('size_guest')
-                    size_guest_rule = value.get('size_guest_rule', "")
-                    # 上半场大小
-                    half_size_home = value.get('half_size_home', "")
-                    half_size_home_rule = value.get('half_size_home_rule', "")
-                    half_size_guest = value.get('half_size_guset', "")
-                    half_size_guest_rule = value.get('half_size_guest_rule', "")
-                    score_status  =  value.get('status','')#比赛状态
-                    if score_status == "True":
-                        score_status = 1
-                    else:
-                        score_status = 0
-
-                    match_score = "{}:{}".format(score_home,score_guest)
-
-
-
-                    #如果角球存在
-                    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 = "bodan"
-                        p_id = 6
-
-                    if StZqResult.filter(match_id=key):
-                        StZqResult.update(update_time=utime,match_score=match_score,match_time=time_game,match_process=half_way,home_score=score_home,guest_score=score_guest).where(StZqResult.match_id == key).execute()
-                    else:
-                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535',p_code=p_code)
-
-                    #全场让球条件
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
-
-
-                    if concede_guest:
-                        for index, result in enumerate(concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
-
-
-                    if half_concede_guest:
-                        for index, result in enumerate(half_concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,expire_time=expire_time,
-                                                      max=half_concede_guest[index],is_rollball=1,
-                                                      condition=half_concede_guest_rule[index],
-                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
-
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
-
-
-
-                    if size_guest:
-                        for index, result in enumerate(size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-
-
-
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_guest_rule[index]).where(StZqOdds.sole==new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
-
-                    #赔率插入记录表
-
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
-                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',is_rollball=1,
-                                                     odds_code="concede_guest",sole=new_hash2)
-
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',
-                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,lg_id=league_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
-                                                     max=half_concede_guest[index],is_rollball=1,
-                                                     condition=half_concede_guest_rule[index],
-                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',
-                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],lg_id=league_id,
-                                                     p_id=p_id, p_code=p_code, sort=index,is_rollball=1,
-                                                     odds_code="half_size_guest",sole=new_hash)
-
-
-
-
-
-                    #赛事表
-                    if StZqCompetition.filter(match_id=key):
-                        StZqCompetition.update(is_rollball=1,expire_time=expire_time,utime=utime,status=score_status,tag=number).where(StZqCompetition.match_id == key).execute()
-                    else:
-                        StZqCompetition.create(is_rollball=1,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,us_time='2019-01-01 00:00:00')
-
-
-                    #更新记录表 具体更新哪些值目前随便写未知
-                    # if StZqResultRecord.filter(match_id=key):
-                    #     StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score,match_time=time_game).where(StZqResultRecord.match_id == key).execute()
-                    # else:
-                    StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,match_id=key,source='hg3535',p_code=p_code)
-
-
-
-
-
-
-                        # for k, v in value.items():
-                        #     if v:
-                        #         for index, result in enumerate(v):
-                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-                        #             if st_zq_odd:
-                        #                 if result:
-                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
-                        #             else:
-                        #                 if result:
-                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-                    # else:
-                    #     for k, v in value.items():
-                    #         if v:
-                    #             for index, result in enumerate(v):
-                    #                 if result:
-                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
-
-        first_last_ball = item.get('first_last_ball', "")
-        if first_last_ball:
-            with database.atomic():
-                #key 联赛id
-                for key, value in first_last_ball.items():
-                    # 比赛日期
-                    data_game = value.pop('data_game').split("/")
-                    month = str(data_game[1].strip())
-                    day = str(data_game[0])
-                    # 比赛时间
-                    time_game = str(value.pop('time_game'))
-                    # 比赛时间,时间戳
-                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
-                    # match_date,match_time = new_time(ctime)
-                    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 = value.pop('game_id')
-                    # 联赛id
-                    league_id = value.pop('league_id')
-                    # 联赛name
-                    league_name = value.pop('league_name')
-                    # 主队
-                    team_home = value.pop('team_home')
-                    # 客队
-                    team_guest = value.pop('team_guest')
-                    # 主队得分
-                    score_home = value.pop('score_home')
-                    # 客队得分
-                    score_guest = value.pop('score_guest')
-                    # 全场让球
-                    # number
-                    number = value.pop('number')
-                    corner_ball = value.pop('corner_ball')
-                    half_way = value.pop('half_way')
-                    concede_home = value.get('concede_home', "")
-                    concede_home_rule = value.get('concede_home_rule', "")
-                    concede_guest = value.get("concede_guest", "")
-                    concede_guest_rule = value.get("concede_guest_rule", "")
-                    # 上半场让球
-                    half_concede_home = value.get("half_concede_home", "")
-                    half_concede_home_rule = value.get("half_concede_home_rule", "")
-                    half_concede_guest = value.get("half_concede_guest", "")
-                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-                    # 全场大小
-                    size_home = value.get('size_home')
-                    size_home_rule = value.get('size_home')
-                    size_guest = value.get('size_guest')
-                    size_guest_rule = value.get('size_guest_rule', "")
-                    # 上半场大小
-                    half_size_home = value.get('half_size_home', "")
-                    half_size_home_rule = value.get('half_size_home_rule', "")
-                    half_size_guest = value.get('half_size_guset', "")
-                    half_size_guest_rule = value.get('half_size_guest_rule', "")
-                    score_status  =  value.get('status','')#比赛状态
-                    if score_status:
-                        score_status = 1
-                    else:
-                        score_status = 0
-
-                    match_score = "{}:{}".format(score_home,score_guest)
-
-
-                    #如果角球存在
-                    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 = "first_last_ball"
-                        p_id = 7
-
-                    if StZqResult.filter(match_id=key):
-                        StZqResult.update(update_time=utime,match_score=match_score,match_time=time_game,match_process=half_way,home_score=score_home,guest_score=score_guest).where(StZqResult.match_id == key).execute()
-                    else:
-                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535',p_code=p_code)
-
-                    #全场让球条件
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
-
-
-                    if concede_guest:
-                        for index, result in enumerate(concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
-
-
-                    if half_concede_guest:
-                        for index, result in enumerate(half_concede_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_concede_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
-                                                      max=half_concede_guest[index],expire_time=expire_time,is_rollball=1,
-                                                      condition=half_concede_guest_rule[index],
-                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
-
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
-
-
-
-                    if size_guest:
-                        for index, result in enumerate(size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=size_guest_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_home_rule[index]).where(StZqOdds.sole == new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-
-
-
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            st_zq_odd = StZqOdds.filter(sole=new_hash)
-                            if st_zq_odd:
-                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time,condition=half_size_guest_rule[index]).where(StZqOdds.sole==new_hash).execute()
-                            else:
-                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,is_rollball=1,
-                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
-
-                    #赔率插入记录表
-
-                    if concede_home:
-                        for index, result in enumerate(concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
-                                                     condition=concede_guest_rule[index], odds=concede_guest[index],is_rollball=1,
-                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
-                                                     odds_code="concede_guest",sole=new_hash2)
-
-
-                    if half_concede_home:
-                        for index, result in enumerate(half_concede_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
-                                                     max=half_concede_guest[index],is_rollball=1,
-                                                     condition=half_concede_guest_rule[index],
-                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
-                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
-
-
-                    if size_home:
-                        for index, result in enumerate(size_home):
-                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
-                            odds_only1 = r_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id,odd=result)
-                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
-                            odds_only2 = r_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
-                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
-
-
-                    if half_size_home:
-                        for index, result in enumerate(half_size_home):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
-                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,is_rollball=1,
-                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
-                    if half_size_guest:
-                        for index, result in enumerate(half_size_guest):
-                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
-                            odds_only = r_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id,odd=result)
-                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',lg_id=league_id,
-                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
-                                                     p_id=p_id, p_code=p_code, sort=index,is_rollball=1,
-                                                     odds_code="half_size_guest",sole=new_hash)
-
-
-
-
-
-                    #赛事表
-                    if StZqCompetition.filter(match_id=key):
-                        StZqCompetition.update(is_rollball=1,expire_time=expire_time,utime=utime,status=score_status,tag=number).where(StZqCompetition.match_id == key).execute()
-                    else:
-                        StZqCompetition.create(is_rollball=1,expire_time=expire_time,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,us_time='2019-01-01 00:00:00')
-
-                    #更新记录表 具体更新哪些值目前随便写未知
-                    # if StZqResultRecord.filter(match_id=key):
-                    #     StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score,match_time=time_game).where(StZqResultRecord.match_id == key).execute()
-                    # else:
-                    StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=1,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process=half_way,tag=number,match_id=key,source='hg3535',p_code=p_code)
-
-
-
-
-
-
-                        # for k, v in value.items():
-                        #     if v:
-                        #         for index, result in enumerate(v):
-                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-                        #             if st_zq_odd:
-                        #                 if result:
-                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
-                        #             else:
-                        #                 if result:
-                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-                    # else:
-                    #     for k, v in value.items():
-                    #         if v:
-                    #             for index, result in enumerate(v):
-                    #                 if result:
-                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
-
-
-
-        # items = dict(item)
-        # print(type(items))
-        # print(items)
-        # StZqOdds.create()
-
-
-
-        # return item
-
-    #爬虫关闭关闭数据库连接
-    def close_spider(self, spider):
-        self.conn.close()
-        self.cursor.close()
-        database.close()
-
-
-# class MysqlTwistedPipline(object):
-#     cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-#
-#     def __init__(self, dbpool):
-#         self.dbpool = dbpool
-#
-#
-#     @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'],
-#             # charset='utf8',
-#             # cursorclass = cls.cursor,
-#             # use_unicode = True,
-#         )
-#         dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-#
-#         return cls(dbpool)
-#
-#     def process_item(self, item, spider):
-#         #使用twisted将mysql插入变成异步执行
-#         query = self.dbpool.runInteraction(self.do_insert, item)
-#         query.addErrback(self.handle_error, item,spider) #处理异常
-#
-#     def handle_error(self, failure, item,spider):
-#         #处理异步插入的异常
-#         print(failure)
-#     def do_insert(self, cursor, item):
-#         #执行具体的插入
-#         #根据不同的item 构建不同的sql语句并插入到mysql中
-#         insert_sql, params = item.get_insert_sql()
-#         cursor.execute(insert_sql, params)
-
-
-
-
-# 球队进球 大小----------------------------------------------------------------------------------------------------------
-class Temaballpipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool, conn, cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    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())
-        # 比赛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']
-        p_code = "temaball"
-        p_id = 11
-        full_dicts = item['full_data']
-        half_dicts = item['half_data']
-        full_dict_rules = item['full_data_rule']
-        half_dict_rules = item['half_data_rule']
-        if full_dicts:
-            for key, value in full_dicts.items():
-                if value:
-                    # 构建唯一索引
-                    new_hash = hash_func(match_id=competition_id, odds_code=key, sort=0, p_id=p_id)
-                    odds_only = r_func(match_id=competition_id, odds_code=key, sort=0, p_id=p_id,odd=value)
-                    # 更新st_zq_odds表
-                    sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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,odds_only=%s;"
-                    cursor.execute(sql1, (
-                    int(league_id), key, int(competition_id), utime, utime, value, value, p_id, p_code, 0, "hg3535",
-                    new_hash, full_dict_rules[key], odds_only,1,utime, value,odds_only))
-                    # 更新st_zq_odds_record
-                    sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code,sort, source,condition,odds_only,is_rollball) values (%s, %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, value, p_id, p_code, 0, "hg3535",
-                    full_dict_rules[key],odds_only,1))
-
-        if half_dicts:
-            for key, value in half_dicts.items():
-                if value:
-                    # 构建唯一索引
-                    new_hash = hash_func(match_id=competition_id, odds_code=key, sort=0, p_id=p_id)
-                    odds_only = r_func(match_id=competition_id, odds_code=key, sort=0, p_id=p_id,odd=value)
-                    # 更新st_zq_odds表
-                    sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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,odds_only=%s;"
-                    cursor.execute(sql1, (
-                    int(league_id), key, int(competition_id), utime, utime, value, value, p_id, p_code, 0, "hg3535",
-                    new_hash, half_dict_rules[key],odds_only,1,utime, value,odds_only))
-                    # 更新st_zq_odds_record
-                    sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code,sort, source,condition,odds_only,is_rollball) values (%s, %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, value, p_id, p_code, 0, "hg3535",
-                    half_dict_rules[key],odds_only,1))
-
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()
-        database.close()
-
-
-
-
-
-
-
-# 篮球 让球大小----------------------------------------------------------------------------------------------------------
-class Lanqiupipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool, conn, cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    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 #home_team
-        team_home = item['team_home']
-        # 球队2 # guest_team
-        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
-        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))#过期时间
-        # 现在时间,时间戳
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-        # 队1分数
-        score_home = item['score_home']
-        # 队2分数
-        score_guest = item['score_guest']
-        # 第几节
-        jijie = item['jijie']
-        # 球队得分
-        qiudui = item['qiudui']
-        pt = item['pt']
-        match_score = "{}:{}".format(score_home,score_guest)
-        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']
-        if concedes_dict:
-            for key, value in concedes_dict.items():
-                if value:
-                    for x, y in enumerate(value):
-                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=1)
-                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=1,odd=y)
-                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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, y, 1, "lq_concede",x, "hg3535", new_hash, concedes_dict_rule[key][x],odds_only,1,utime, y,odds_only))
-                        # res = cursor.fetchone()
-                        # 更新主队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_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
-                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 1, "lq_concede", x, "hg3535", concedes_dict_rule[key][x],odds_only,1))
-                        #插入结果表
-                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
-                        #插入记录表
-                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
-                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
-
-
-
-        if odd_evens_dict:
-            for key, value in odd_evens_dict.items():
-                if value:
-                    for x, y in enumerate(value):
-                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=2)
-                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=2,odd=y)
-                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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,y, 2, "lq_two_sides",x, "hg3535", new_hash, odd_evens_dict_rule[key][x],odds_only,1,utime, y,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, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
-                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 2, "lq_two_sides", x, "hg3535", odd_evens_dict_rule[key][x],odds_only,1))
-                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
-                        #插入记录表
-                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
-                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
-
-
-
-        if total_sizes_dict:
-            for key, value in total_sizes_dict.items():
-                if value:
-                    for x, y in enumerate(value):
-                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=3)
-                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=3,odd=y)
-                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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,y, 3, "lq_total_size",x, "hg3535", new_hash, total_sizes_dict_rule[key][x],odds_only,1,utime, y,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, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
-                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime, y, 3, "lq_total_size", x, "hg3535", total_sizes_dict_rule[key][x],odds_only,1))
-                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
-                        #插入记录表
-                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
-                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
-
-
-        last_home = last_numbers_dict['lq_last_home']
-        if last_home:
-            for key, value in last_home.items():
-                if value:
-                    new_hash = hash_func(match_id=game_id, odds_code="last_home" + key, sort=0, p_id=4)
-                    odds_only = r_func(match_id=game_id, odds_code="last_home", sort=0, p_id=4,odd=value)
-                    sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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), "last_home", int(game_id), utime, utime, value, 4, "lq_last_number",0, "hg3535", new_hash, key,odds_only,1,utime, value,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, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
-                    cursor.execute(sql2, (int(league_id), "last_home", int(game_id), utime, utime,value, 4, "lq_last_number", 0, "hg3535", key,odds_only,1))
-                    sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
-                    #插入记录表
-                sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
-                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
-
-        last_guest = last_numbers_dict['lq_last_guest']
-        if last_guest:
-            for key, value in last_guest.items():
-                if value:
-                    new_hash = hash_func(match_id=game_id, odds_code="last_guest" + key, sort=0, p_id=4)
-                    odds_only = r_func(match_id=game_id, odds_code="last_guest", sort=0, p_id=4,odd=value)
-                    sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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), "last_guest", int(game_id), utime, utime, value, 4, "lq_last_number",0, "hg3535", new_hash, key,odds_only,1,utime, value,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, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
-                    cursor.execute(sql2, (int(league_id), "last_guest", int(game_id), utime, utime,value, 4, "lq_last_number", 0, "hg3535", key,odds_only,1))
-                    sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
-                        #插入记录表
-                sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
-                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
-
-        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=5)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=5,odd=value)
-                    sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_rollball) values (%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, 5, "lq_capot",0, "hg3535", new_hash, odds_only,1,utime, value,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_rollball) 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, 5, "lq_capot", 0, "hg3535",odds_only,1))
-                    sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
-                    #插入记录表
-                sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
-                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
-
-        if team_scores_dict:
-            for key, value in team_scores_dict.items():
-                if value:
-                    for x, y in enumerate(value):
-                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=6)
-                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=6,odd=y)
-                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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, y, 6, "lq_team_score", x, "hg3535", new_hash,team_scores_dict_rule[key][x], odds_only,1,utime, y,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, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
-                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 6, "lq_team_score", x, "hg3535",team_scores_dict_rule[key][x],odds_only,1))
-                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
-                        #插入记录表
-                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
-                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
-        # 插入赛事表
-        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_rollball) 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;"
-        print(Competition_sql)
-        cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id, r_ctime, time_game, utime, utime, number, pt, "hg3535",expire_time,1,number,expire_time))
-
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()
-
-
-
-# 网球 让球&大小盘--------------------------------------------------------------------------------------------------------
-class Wangqiupipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool,conn,cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    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())
-        # 队1分数
-        score_home = item['score_home']
-        # 队2分数
-        score_guest = item['score_guest']
-        # 第几节
-        jijie = item['jijie']
-        # 球队得分
-        qiudui = item['qiudui']
-        pt = item['pt']
-        #取不到 暂时注掉
-        match_date, match_time = new_time(ctime)
-        # 让盘
-        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']
-        if concedes_dict:
-            for key, value in concedes_dict.items():
-                if value:
-                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
-                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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, 1, "wq_concede", 0, "hg3535", new_hash,
-                    concedes_dict_rule[key],odds_only,1,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, condition,odds_only,is_rollball) values (%s, %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, 1, "wq_concede", 0, "hg3535",
-                    concedes_dict_rule[key],odds_only,1))
-                    #插入结果表
-                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
-                    # 插入记录表
-                sql4 = "insert into st_wq_result_record(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);"
-                cursor.execute(sql4, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00'))
-
-
-        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)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
-                    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_rollball) values (%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,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_rollball) 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))
-
-                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
-
-        if bureaus_dict:
-            for key, value in bureaus_dict.items():
-                if value:
-                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=3)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=3,odd=value)
-                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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, 3, "wq_bureau", 0, "hg3535", new_hash,
-                    bureaus_dict_rule[key],odds_only,1,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, condition,odds_only,is_rollball) values (%s, %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, 3, "wq_bureau", 0, "hg3535",
-                    bureaus_dict_rule[key],odds_only,1))
-                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
-
-        if total_number_dict:
-            for key, value in total_number_dict.items():
-                if value:
-                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=4)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=4,odd=value)
-                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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, 4, "wq_total_number", 0, "hg3535", new_hash,
-                    total_number_dict_rule[key],odds_only,1,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, condition,odds_only,is_rollball) values (%s, %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, "wq_total_number", 0, "hg3535",
-                    total_number_dict_rule[key],odds_only,1))
-                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
-
-        if odd_evens_dict:
-            for key, value in odd_evens_dict.items():
-                if value:
-                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=5)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=5,odd=value)
-                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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, 5, "wq_two_sides", 0, "hg3535", new_hash,
-                    odd_evens_dict_rule[key],odds_only,1,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, condition,odds_only,is_rollball) values (%s, %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, 5, "wq_two_sides", 0, "hg3535",odd_evens_dict_rule[key],odds_only,1))
-                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
-
-        # 插入赛事表
-        Competition_sql = "insert into st_wq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source,is_rollball) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s,%s) on conflict(match_id) do update set tag = %s;"
-        cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, pt, "hg3535",1,number))
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()
-
-
-#网球
-# class Wangqiupipeline1(object):
-#     cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-#
-#     def __init__(self, dbpool):
-#         self.dbpool = dbpool
-#
-#     @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'],
-#             # charset='utf8',
-#             # cursorclass = cls.cursor,
-#             # use_unicode = True,
-#         )
-#         dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-#         return cls(dbpool)
-#
-#     def process_item(self, item, spider):
-#         # 使用twisted将mysql插入变成异步执行
-#         query = self.dbpool.runInteraction(self.do_insert, item)
-#         query.addErrback(self.handle_error, item, spider)  # 处理异常
-#
-#     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())
-#         # 队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']
-#         odd_evens_dict = item['odd_evens_dict']
-#         odd_evens_dict_rule = item['odd_evens_dict_rule']
-#         total_sizes_dict = item['total_number_dict']
-#         total_sizes_dict_rule = item['total_number_dict_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']
-#         if concedes_dict:
-#             for key, value in concedes_dict.items():
-#                 if value:
-#                     new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
-#                     sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
-#                     cursor.execute(sql1, (
-#                     int(league_id), key, int(game_id), utime, utime, value, value, 1, "concede", 0, "hg3535", new_hash,
-#                     concedes_dict_rule[key], utime, value))
-#                     # 更新主队st_zq_odds_record表
-#                     sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, value, 1, "concede", 0, "hg3535",
-#                     concedes_dict_rule[key]))
-#
-#         # if odd_evens_dict:
-#         #     for key, value in odd_evens_dict.items():
-#         #         if value:
-#         #             for x, y in enumerate(value):
-#         #                 new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=2)
-#         #                 sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
-#         #                 cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, y, 2, "odd_even",x, "hg3535", new_hash, odd_evens_dict_rule[key][x], utime, y))
-#         #                 # 更新主队st_zq_odds_record表
-#         #                 sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, y, y, 2, "odd_even", x, "hg3535", odd_evens_dict_rule[key][x]))
-#
-#         # if total_sizes_dict:
-#         #     for key, value in total_sizes_dict.items():
-#         #         if value:
-#         #             for x, y in enumerate(value):
-#         #                 new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=3)
-#         #                 sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
-#         #                 cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, y, 3, "total_size",x, "hg3535", new_hash, total_sizes_dict_rule[key][x], utime, y))
-#         #                 # 更新主队st_zq_odds_record表
-#         #                 sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, y, y, 3, "total_size", x, "hg3535", total_sizes_dict_rule[key][x]))
-#
-#         # last_home = last_numbers_dict['last_home']
-#         # if last_home:
-#         #     for key, value in last_home.items():
-#         #         if value:
-#         #             new_hash = hash_func(match_id=game_id, odds_code="last_home" + key, sort=0, p_id=4)
-#         #             sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
-#         #             cursor.execute(sql1, (int(league_id), "last_home", int(game_id), utime, utime, value, value, 4, "last_number",0, "hg3535", new_hash, key, utime, value))
-#         #             # 更新主队st_zq_odds_record表
-#         #             sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
-#         #             cursor.execute(sql2, (int(league_id), "last_home", int(game_id), utime, utime, value, value, 4, "last_number", 0, "hg3535", key))
-#
-#         # last_guest = last_numbers_dict['last_home']
-#         # if last_guest:
-#         #     for key, value in last_guest.items():
-#         #         if value:
-#         #             new_hash = hash_func(match_id=game_id, odds_code="last_guest" + key, sort=0, p_id=4)
-#         #             sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
-#         #             cursor.execute(sql1, (int(league_id), "last_guest", int(game_id), utime, utime, value, value, 4, "last_number",0, "hg3535", new_hash, key, utime, value))
-#         #             # 更新主队st_zq_odds_record表
-#         #             sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
-#         #             cursor.execute(sql2, (int(league_id), "last_guest", int(game_id), utime, utime, value, value, 4, "last_number", 0, "hg3535", key))
-#
-#         # 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=5)
-#         #             sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
-#         #             cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, value, value, 5, "capot",0, "hg3535", new_hash, utime, value))
-#         #             # 更新主队st_zq_odds_record表
-#         #             sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source) 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, value, 5, "capot", 0, "hg3535"))
-#
-#         # if team_scores_dict:
-#         #     for key, value in team_scores_dict.items():
-#         #         if value:
-#         #             for x, y in enumerate(value):
-#         #                 new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=6)
-#         #                 sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
-#         #                 cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, y, 6, "team_score", x, "hg3535", new_hash,team_scores_dict_rule[key][x], utime, y))
-#         #                 # 更新主队st_zq_odds_record表
-#         #                 sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, y, y, 6, "team_score", x, "hg3535",team_scores_dict_rule[key][x]))
-#         # 插入赛事表
-#         Competition_sql = "insert into st_lq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s) on conflict(match_id) do update set tag = %s;"
-#         print(Competition_sql)
-#         cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id, r_ctime, time_game, utime, utime, number, pt, "hg3535",number))
-
-
-
-# 棒球 插入赔率----------------------------------------------------------------------------------------------------------
-def bqone_intodb(data1, data2, data3, cursor):
-    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'])
-                odds_only = r_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'],odd=value)
-                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_rollball) 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(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))
-                # 更新主队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_rollball) 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))
-                # sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                # cursor.execute(sql3, (int(data2['league_id']), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',utime,qiudui,r_ctime,jijie,score_home,score_guest))
-
-
-
-
-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
-
-
-
-class Banqiupipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool, conn, cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    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".strip()
-        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']
-        #滚球这个位置获取不到这些字段
-        # match_date, match_time = new_time(ctime)
-        # 让球
-        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}
-        bqone_intodb(data1=concedes_dict, data2=concede, data3=concedes_dict_rule, cursor=cursor)
-        # 总得分:大/小
-        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}
-        bqone_intodb(data1=total_size_dict, data2=total_size, data3=total_size_dict_rule, cursor=cursor)
-
-        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}
-        bqone_intodb(data1=odd_evens_dict, data2=odd_even, data3=odd_evens_dict_rule, cursor=cursor)
-        # 赛事失效时间
-        # n_time = out_time(ctime, 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=2)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
-                    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_rollball) 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_rollball) 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))
-
-                    sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',utime,qiudui,r_ctime,jijie,score_home,score_guest))
-        # 插入赛事表
-            Competition_sql = "insert into st_bq_competition(home_team,guest_team,lg_id,status,match_id,ctime,utime,tag,source,type,is_rollball,is_today) values(%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s,%s) on conflict(match_id) do update set tag=%s,is_today=%s,utime=%s;"
-            cursor.execute(Competition_sql, (team_home, team_guest, league_id, 1,game_id,utime, utime, number,"hg3535",1,1,1,number,1,utime))
-
-
-
-
-
-
-
-        # if concedes_dict:
-        #     for key, value in concedes_dict.items():
-        #         if value:
-        #             new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2,pt=4)
-        #             odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,pt=4,odd=value)
-        #             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_rollball) 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_rollball) 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))
-        #
-        #             sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-        #             cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',utime,qiudui,r_ctime,jijie,score_home,score_guest))
-        # # 插入赛事表
-        #     Competition_sql = "insert into st_bq_competition(home_team,guest_team,lg_id,status,match_id,ctime,utime,tag,source,type,is_rollball,is_today) values(%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s,%s) on conflict(match_id) do update set tag=%s,is_today=%s,utime=%s;"
-        #     cursor.execute(Competition_sql, (team_home, team_guest, league_id, 1,game_id,utime, utime, number,"hg3535",1,1,1,number,1,utime))
-
-
-
-        if concedes_dict:
-            for key, value in concedes_dict.items():
-                if value:
-                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
-                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
-                    sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) 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, 1, "bq_concede", 0, "hg3535", new_hash,
-                    concedes_dict_rule[key],odds_only,1,utime, value,odds_only))
-                    # 更新主队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_rollball) values (%s, %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, 1, "bq_concede", 0, "hg3535",
-                    concedes_dict_rule[key],odds_only,1))
-                    #插入结果表
-                    sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
-                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',utime,qiudui,r_ctime,jijie,score_home,score_guest))
-                    # 插入记录表
-                sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);"
-                cursor.execute(sql4, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00'))
-            # Competition_sql = "insert into st_bq_competition(home_team, guest_team, lg_id,'2', match_id,ctime, utime, tag,type,source,is_today,is_rollball) values (%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, (team_home, team_guest, league_id, game_id,utime, utime, number, pt,"hg3535",1,1,number,1,0,0))
-            # Competition_sql = "insert into st_bq_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, (team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, pt,"hg3535",n_time,0,1,0,number, n_time,0,1,0))
-            # Competition_sql = "insert into st_bq_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, (team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, pt,"hg3535",n_time,0,0,1,number, n_time,0,0,1))
-
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()
-
-
-
-
-class BallStatuspipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool,conn,cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    def handle_error(self, failure, item, spider):
-        # 处理异步插入的异常
-        print(failure)
-
-    def do_insert(self, cursor, item):
-        # 联赛id
-        if isinstance(item, Zuqiustatus):
-            zuqiu_toal = item['zuqiu_total']
-            for i in zuqiu_toal:
-                print(i)
-                match_id = i['match_id']
-                create_time = i['create_time']
-                staus = i['status']
-                update_time = i['create_time']
-                ball_type = i['ball_type']
-                sql1 = "insert into st_ball_status(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s) on conflict(match_id) do update set update_time = %s;"
-                # sql1 = "insert into st_ball_status2(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s);"
-                cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                sql2 = "update st_zq_result set status=1  where match_id={}".format(match_id)
-                sql3 = "update st_zq_result_record set status=1  where match_id={}".format(match_id)
-                sql4 = "update st_zq_competition set status=1  where match_id={}".format(match_id)
-                cursor.execute(sql2)
-                cursor.execute(sql3)
-                cursor.execute(sql4)
-            # print(zuqiu_toal)
-            # print(type(zuqiu_toal))
-
-        # match_id = item['match_id']
-        # ball_type = item['ball_type']
-        # zuqiu_toal = item['zuqiu_total']
-
-
-
-
-        # 现在时间,时间戳
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-
-
-
-
-
-
-
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()
-
-
-
-class BangqiuStatuspipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool,conn,cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    def handle_error(self, failure, item, spider):
-        # 处理异步插入的异常
-        print(failure)
-
-    def do_insert(self, cursor, item):
-        # 联赛id
-        if isinstance(item, Bangqiustatus):
-            zuqiu_toal = item['bangqiu_total']
-            for i in zuqiu_toal:
-                print(i)
-                match_id = i['match_id']
-                create_time = i['create_time']
-                staus = i['status']
-                update_time = i['create_time']
-                ball_type = i['ball_type']
-                sql1 = "insert into st_ball_status(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s) on conflict(match_id) do update set update_time = %s;"
-                # sql1 = "insert into st_ball_status2(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s);"
-                cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-            # print(zuqiu_toal)
-            # print(type(zuqiu_toal))
-
-        # match_id = item['match_id']
-        # ball_type = item['ball_type']
-        # zuqiu_toal = item['zuqiu_total']
-
-
-
-
-        # 现在时间,时间戳
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-
-
-
-
-
-
-
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()
-
-
-
-
-class lanqiuStatuspipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool,conn,cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    def handle_error(self, failure, item, spider):
-        # 处理异步插入的异常
-        print(failure)
-
-    def do_insert(self, cursor, item):
-        # 联赛id
-        if isinstance(item, Lanqiustatus):
-            zuqiu_toal = item['lanqiu_total']
-            for i in zuqiu_toal:
-                print(i)
-                match_id = i['match_id']
-                create_time = i['create_time']
-                staus = i['status']
-                update_time = i['create_time']
-                ball_type = i['ball_type']
-                sql1 = "insert into st_ball_status(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s) on conflict(match_id) do update set update_time = %s;"
-                # sql1 = "insert into st_ball_status2(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s);"
-                cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-            # print(zuqiu_toal)
-            # print(type(zuqiu_toal))
-
-        # match_id = item['match_id']
-        # ball_type = item['ball_type']
-        # zuqiu_toal = item['zuqiu_total']
-
-
-
-
-        # 现在时间,时间戳
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-
-
-
-
-
-
-
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()
-
-
-
-class WangqiuStatuspipeline(object):
-    # cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-    def __init__(self, dbpool, conn, cursor):
-        self.dbpool = dbpool
-        self.conn = conn
-        self.cursor = cursor
-
-    @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'],
-            # charset='utf8',
-            # cursorclass = cls.cursor,
-            # use_unicode = True,
-        )
-        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-
-        conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
-        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        return cls(dbpool,conn,cursor)
-
-    def process_item(self, item, spider):
-        # 使用twisted将mysql插入变成异步执行
-        query = self.dbpool.runInteraction(self.do_insert, item)
-        query.addErrback(self.handle_error, item, spider)  # 处理异常
-
-    def handle_error(self, failure, item, spider):
-        # 处理异步插入的异常
-        print(failure)
-
-    def do_insert(self, cursor, item):
-        # 联赛id
-        if isinstance(item, Wanqiustatus):
-            zuqiu_toal = item['wangqiu_total']
-            for i in zuqiu_toal:
-                print(i)
-                match_id = i['match_id']
-                create_time = i['create_time']
-                staus = i['status']
-                update_time = i['create_time']
-                ball_type = i['ball_type']
-                sql1 = "insert into st_ball_status(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s) on conflict(match_id) do update set update_time = %s;"
-                # sql1 = "insert into st_ball_status2(match_id, create_time, status,update_time, ball_type) values (%s,%s, %s, %s, %s);"
-                cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-            # print(zuqiu_toal)
-            # print(type(zuqiu_toal))
-
-        # match_id = item['match_id']
-        # ball_type = item['ball_type']
-        # zuqiu_toal = item['zuqiu_total']
-
-
-
-
-        # 现在时间,时间戳
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-
-
-
-
-
-
-
-
-    def close_spider(self, spider):
-        self.conn.close()
-        self.dbpool.close()

+ 0 - 120
scrapy_yzd/scrapy_yzd/settings.py

@@ -1,120 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Scrapy settings for scrapy_yzd project
-#
-# For simplicity, this file contains only settings considered important or
-# commonly used. You can find more settings consulting the documentation:
-#
-#     http://doc.scrapy.org/en/latest/topics/settings.html
-#     http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
-#     http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
-
-BOT_NAME = 'scrapy_yzd'
-
-SPIDER_MODULES = ['scrapy_yzd.spiders']
-NEWSPIDER_MODULE = 'scrapy_yzd.spiders'
-
-LOG_LEVEL = 'INFO'
-# Crawl responsibly by identifying yourself (and your website) on the user-agent
-USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
-
-# Obey robots.txt rules
-ROBOTSTXT_OBEY = False
-
-# Configure maximum concurrent requests performed by Scrapy (default: 16)
-#CONCURRENT_REQUESTS = 32
-
-# Configure a delay for requests for the same website (default: 0)
-# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
-# See also autothrottle settings and docs
-DOWNLOAD_DELAY = 2
-# The download delay setting will honor only one of:
-#CONCURRENT_REQUESTS_PER_DOMAIN = 16
-#CONCURRENT_REQUESTS_PER_IP = 16
-
-# 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 http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
-# from scrapy_deltafetch import DeltaFetch
-# SPIDER_MIDDLEWARES = {
-# 'scrapy_deltafetch.DeltaFetch': 1
-# }
-# DELTAFETCH_ENABLED = True
-
-# Enable or disable downloader middlewares
-# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
-DOWNLOADER_MIDDLEWARES = {
-    # 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware': None,  # 把本来的代理中间件废掉
-    # 'scrapy_yzd.middlewares.RotateUserAgentMiddleware': 400,  # 切换agent
-    # 'scrapy_yzd.autoproxy.AutoProxyMiddleware': 543  # 代理池
-}
-
-AUTO_PROXY = {  # 代理池中间件设置,详见Github
-    #'test_urls':[('http://www.jd.com', '4006561155')],
-    'ban_code': [500, 502, 503, 400, 504],
-    'init_valid_proxys': 2,
-}
-
-# Enable or disable extensions
-# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
-#EXTENSIONS = {
-#    'scrapy.extensions.telnet.TelnetConsole': None,
-#}
-
-# Configure item pipelines
-# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
-ITEM_PIPELINES = {
-    # Lanqiupipeline
-    # 'scrapy_yzd.pipelines.Lanqiupipeline':1,
-    # 'scrapy_yzd.pipelines.Wangqiupipeline':1,
-    # 'scrapy_yzd.pipelines.BallStatuspipeline':1,
-   # 'scrapy_yzd.pipelines.SomePipeline': 300,
-   #  'scrapy_yzd.pipelines.ScrapyYzdPipeline':100,
-   #  'scrapy_yzd.pipelines.Temaballpipeline':1
-   #  'scrapy_yzd.pipelines.MysqlTwistedPipline':1
-   #  'scrapy_yzd.pipelines.Banqiupipeline':1
-}
-
-# Enable and configure the AutoThrottle extension (disabled by default)
-# See http://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 http://scrapy.readthedocs.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'
-
-
-# database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-
-# database = PostgresqlDatabase('postgres', **{'host': '127.0.0.1', 'port': 5432, 'user': 'postgres', 'password': '9998877'})
-
-
-POST_HOST = '192.168.2.200'
-POST_DATABASE = 'kaiyou'
-POST_USER = 'kaiyou'
-POST_PORT = '10432'
-POST_PASSWORD = '123456'

+ 0 - 4
scrapy_yzd/scrapy_yzd/spiders/__init__.py

@@ -1,4 +0,0 @@
-# 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.

BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bangqiu.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bq_status.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bq_status_up.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_lanqiu.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_lq_status.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_lq_status_up.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_supplement.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_wangqiu.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_wq_status.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_wq_status_up.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_zq_status.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_zq_status_up.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_zuqiu.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/test.cpython-36.pyc


File diff suppressed because it is too large
+ 0 - 32
scrapy_yzd/scrapy_yzd/spiders/hg3535_bangqiu.py


+ 0 - 231
scrapy_yzd/scrapy_yzd/spiders/hg3535_bq_status.py

@@ -1,231 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-
-import jsonpath
-import scrapy
-import time
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-from scrapy_yzd.items import Lanqiu, Bangqiustatus
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class BangqiuSpider(scrapy.Spider):
-    name = "bangqiu_status"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=4&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    custom_settings = {
-        "ITEM_PIPELINES": {
-            'scrapy_yzd.pipelines.BangqiuStatuspipeline':200,
-        }
-    }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        datas = json.loads(response.text)
-        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        item = Bangqiustatus()
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-        # zuqiu_total = {}
-        bangqiu_status_list = []
-        if ids:
-            ids = set(ids)
-            for i in ids:
-                zuqiu = {}
-                zuqiu['match_id'] = i
-                zuqiu['create_time'] = utime
-                zuqiu['status'] = 1
-                zuqiu['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['match_id'] = i
-                # item['create_time'] = utime
-                # item['status'] = 1
-                # item['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['zuqiu_toal'] = zuqiu
-                bangqiu_status_list.append(zuqiu)
-            item["bangqiu_total"] = bangqiu_status_list
-            yield item
-
-        # urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0''http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0','http://hg3535z.com/odds2/d/getodds?sid=4&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
-        # for url in urls:
-        #     yield Request(url=url, callback=self.parse)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 322
scrapy_yzd/scrapy_yzd/spiders/hg3535_bq_status_up.py

@@ -1,322 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import jsonpath
-import scrapy
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-import re
-from scrapy.xlib.pydispatch import dispatcher
-from scrapy import signals
-
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        # self.cursor = self.conn.cursor()
-
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class LanqiuSpider(scrapy.Spider):
-    def __init__(self):
-        super(LanqiuSpider).__init__()
-        #信号量
-        # dispatcher.connect(self.spider_opened, signals.spider_opened)
-        dispatcher.connect(self.spider_closed, signals.spider_closed)
-        # self.conn = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-        self.conn = SqlConn(sql_name='postgresql',host='192.168.2.200',port=10432,user='kaiyou',password='123456',database='kaiyou')
-
-
-
-    name = "bangqiu_status_update"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=4&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    # custom_settings = {
-    #     "ITEM_PIPELINES": {
-    #         'scrapy_yzd.pipelines.BallStatuspipeline':1,
-    #     }
-    # }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # a.test_conn()
-        b = self.conn.get_data("select match_id from st_ball_status where ball_type='棒球'")
-        d = list(itertools.chain(*b))
-        # yield Request(url='http://hg3535z.com/odds2/d/getamodds?eid=3147927&iip=true&ubt=am&isp=false',callback=self.parse_each)
-        for i in d:
-            urls = 'https://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-            yield Request(url=urls,callback=self.parse_each)
-
-    #取得url中的id字段
-    def re_str(self,url_str):
-        a = (re.findall(r"eid=(.+?)&",url_str))
-        result = "".join(a)
-        return result
-
-    def parse_each(self,response):
-        # print("URL: " + response.request.url)
-        if response.text != "null":
-            res = json.loads(response.text)
-            # res = {"i":['false',1,3149430,4,2,"sh",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"28 / 04","99:00","下半场",'false','true',"足球",0],"eg":{"c":{"k":27078,"n":"罗马尼亚乙组联赛"},"es":[{"dbg":'true',"egid":0,"g":"","i":["阿格斯","法乌尔","1","True","28 / 04","","1","False","0","0","0","1","FT","","","",0,"0","1",0,"False"],"ibs":'true',"ibsc":'true',"lcd":{"lcpid":5,"ilup":'false',"lcid":3147921,"p":0},"k":3147921,"o":{},"pci":{"ctid":0},"egn":""},{"dbg":'false',"egid":0,"g":"","i":["阿格斯-角球数","法乌尔-角球数","1","True","28 / 04","99:00","1","False","0","0","4","2","下半场","Second Half","","",0,"","",0,"False"],"ibs":'true',"ibsc":'false',"k":3149430,"o":{"oe":{"s":192,"v":["o3239030643","0.00","o3239030644","0.00"],"n":"角球:滚球 单 / 双"}},"pci":{"ctid":1,"ctn":"角球"},"egn":""}]},"ot":2,"sc":{"3147921":{"a":1,"h":0},"3149430":{"a":2,"h":4}},"v":567862}
-            # res1 = jsonpath.jsonpath(res,'$..eg..es[0]..o')
-            res1 = jsonpath.jsonpath(res,'$..eg..es[:]..o')
-            if len(res1) > 1:
-                print("这是有角球啊")
-                o_dict0 = res1[0]  # 递归取o字典
-                o_dict1 = res1[1]
-                re_url = response.request.url
-                res_id = self.re_str(re_url)
-                print("我是角球id是")
-                print(res_id)
-                if o_dict0 or o_dict1:
-                    print("这不是个空字典")
-                    print("我不做任何操作的啊")
-                    # re_url = response.request.url
-                    # res_id = self.re_str(re_url)
-                    # print(res_id)
-                    # utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s"
-                    # self.conn.cursor.execute(sql1,(4,'zq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    # self.conn.commit()
-            else:
-                o_dict0 = res1[0]
-                if not o_dict0:
-                    print("这是空字典我要改状态")
-                    re_url = response.request.url
-                    res_id = self.re_str(re_url)
-                    print(res_id)
-                    utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    self.conn.updata_data("update st_bq_result set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_bq_result_record set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_bq_competition set status=2  where match_id={}".format(res_id))
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s,game_code='bq',status=4"
-                    # self.conn.cursor.execute(sql1,(4,'bq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    self.conn.commit()
-        # if o_dict:
-        #     print("有数据")
-        # else:
-        #     print("没数据")
-
-        if response.text == "null":
-            print("暂时没有数据")
-            re_url = response.request.url
-            res_id = self.re_str(re_url)
-            print(res_id)
-            utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-            # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-            # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-            # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s,game_code='bq',status=4"
-            # self.conn.cursor.execute(sql1,(4,'zq',res_id,utime,utime))
-
-            self.conn.updata_data("update st_bq_result set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_bq_result_record set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_bq_competition set status=2  where match_id={}".format(res_id))
-            # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-
-            self.conn.commit()
-
-            # a.close_conn()
-
-    # def spider_opened(self, spider):
-
-
-    def spider_closed(self, spider):
-        print("我要关闭了")
-        self.conn.close_conn()
-
-
-        # new_datas = json.loads(response.text).get('eg', "")
-        # if new_datas:
-        #     new_data = new_datas.get("es", "")
-        #     result = new_data[0]
-        #     o_dic = result['o']
-        #     if response.text == "null"  or not o_dic:
-        #         print("没有数据")
-        # print(response.body)
-        # if response.text == "null":
-        #     print("这个网页没有数据的")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 820
scrapy_yzd/scrapy_yzd/spiders/hg3535_lanqiu.py

@@ -1,820 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-
-import jsonpath
-import scrapy
-from scrapy.http import Request
-
-from scrapy_yzd.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 = [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 = [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']
-    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    custom_settings = {
-        "ITEM_PIPELINES": {
-            "scrapy_yzd.pipelines.Lanqiupipeline": 200,
-        }
-    }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        datas = json.loads(response.text)
-        # item = Today_all()
-        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        print(ids)
-        if ids:
-            ids = set(ids)
-            for i in ids:
-                urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-                print(urls)
-                yield Request(url=urls, callback=self.parse_other)
-
-
-    def parse_other(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]
-            time_game = result['sb']['ct']
-            # 队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'] = half_concede_home_rule
-                concedes_dict['lq_one_concede_home'] = half_concede_home
-                concedes_dict_rule['lq_one_concede_guest'] = half_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']["ou2st"]["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']["ou3st"]["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']["ou4st"]["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_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'] = '双'
-            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 = ""
-            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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 231
scrapy_yzd/scrapy_yzd/spiders/hg3535_lq_status.py

@@ -1,231 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-
-import jsonpath
-import scrapy
-import time
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-from scrapy_yzd.items import Lanqiu, Bangqiustatus, Lanqiustatus
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class BangqiuSpider(scrapy.Spider):
-    name = "lanqiu_status"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    custom_settings = {
-        "ITEM_PIPELINES": {
-            'scrapy_yzd.pipelines.lanqiuStatuspipeline':200,
-        }
-    }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        datas = json.loads(response.text)
-        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        item = Lanqiustatus()
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-        # zuqiu_total = {}
-        bangqiu_status_list = []
-        if ids:
-            ids = set(ids)
-            for i in ids:
-                zuqiu = {}
-                zuqiu['match_id'] = i
-                zuqiu['create_time'] = utime
-                zuqiu['status'] = 1
-                zuqiu['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['match_id'] = i
-                # item['create_time'] = utime
-                # item['status'] = 1
-                # item['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['zuqiu_toal'] = zuqiu
-                bangqiu_status_list.append(zuqiu)
-            item["lanqiu_total"] = bangqiu_status_list
-            yield item
-
-        # urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0''http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0','http://hg3535z.com/odds2/d/getodds?sid=4&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
-        # for url in urls:
-        #     yield Request(url=url, callback=self.parse)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 321
scrapy_yzd/scrapy_yzd/spiders/hg3535_lq_status_up.py

@@ -1,321 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import jsonpath
-import scrapy
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-import re
-from scrapy.xlib.pydispatch import dispatcher
-from scrapy import signals
-
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        # self.cursor = self.conn.cursor()
-
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class LanqiuSpider(scrapy.Spider):
-    def __init__(self):
-        super(LanqiuSpider).__init__()
-        #信号量
-        # dispatcher.connect(self.spider_opened, signals.spider_opened)
-        dispatcher.connect(self.spider_closed, signals.spider_closed)
-        # self.conn = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-        self.conn = SqlConn(sql_name='postgresql',host='192.168.2.200',port=10432,user='kaiyou',password='123456',database='kaiyou')
-
-
-
-    name = "lanqiu_status_update"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    # custom_settings = {
-    #     "ITEM_PIPELINES": {
-    #         'scrapy_yzd.pipelines.BallStatuspipeline':1,
-    #     }
-    # }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # a.test_conn()
-        b = self.conn.get_data("select match_id from st_ball_status where ball_type='篮球'")
-        d = list(itertools.chain(*b))
-        # yield Request(url='http://hg3535z.com/odds2/d/getamodds?eid=3147927&iip=true&ubt=am&isp=false',callback=self.parse_each)
-        for i in d:
-            urls = 'https://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-            yield Request(url=urls,callback=self.parse_each)
-
-    #取得url中的id字段
-    def re_str(self,url_str):
-        a = (re.findall(r"eid=(.+?)&",url_str))
-        result = "".join(a)
-        return result
-
-    def parse_each(self,response):
-        # print("URL: " + response.request.url)
-        if response.text != "null":
-            res = json.loads(response.text)
-            # res = {"i":['false',1,3149430,4,2,"sh",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"28 / 04","99:00","下半场",'false','true',"足球",0],"eg":{"c":{"k":27078,"n":"罗马尼亚乙组联赛"},"es":[{"dbg":'true',"egid":0,"g":"","i":["阿格斯","法乌尔","1","True","28 / 04","","1","False","0","0","0","1","FT","","","",0,"0","1",0,"False"],"ibs":'true',"ibsc":'true',"lcd":{"lcpid":5,"ilup":'false',"lcid":3147921,"p":0},"k":3147921,"o":{},"pci":{"ctid":0},"egn":""},{"dbg":'false',"egid":0,"g":"","i":["阿格斯-角球数","法乌尔-角球数","1","True","28 / 04","99:00","1","False","0","0","4","2","下半场","Second Half","","",0,"","",0,"False"],"ibs":'true',"ibsc":'false',"k":3149430,"o":{"oe":{"s":192,"v":["o3239030643","0.00","o3239030644","0.00"],"n":"角球:滚球 单 / 双"}},"pci":{"ctid":1,"ctn":"角球"},"egn":""}]},"ot":2,"sc":{"3147921":{"a":1,"h":0},"3149430":{"a":2,"h":4}},"v":567862}
-            # res1 = jsonpath.jsonpath(res,'$..eg..es[0]..o')
-            res1 = jsonpath.jsonpath(res,'$..eg..es[:]..o')
-            if len(res1) > 1:
-                print("这是有角球啊")
-                o_dict0 = res1[0]  # 递归取o字典
-                o_dict1 = res1[1]
-                re_url = response.request.url
-                res_id = self.re_str(re_url)
-                print("我是角球id是")
-                print(res_id)
-                if o_dict0 or o_dict1:
-                    print("这不是个空字典")
-                    print("我不做任何操作的啊")
-                    # re_url = response.request.url
-                    # res_id = self.re_str(re_url)
-                    # print(res_id)
-                    # utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s"
-                    # self.conn.cursor.execute(sql1,(4,'zq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    # self.conn.commit()
-            else:
-                o_dict0 = res1[0]
-                if not o_dict0:
-                    print("这是空字典我要改状态")
-                    re_url = response.request.url
-                    res_id = self.re_str(re_url)
-                    print(res_id)
-                    utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s,game_code='lq',status=4"
-                    self.conn.updata_data("update st_lq_result set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_lq_result_record set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_lq_competition set status=2  where match_id={}".format(res_id))
-                    # self.conn.cursor.execute(sql1,(4,'lq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    self.conn.commit()
-        # if o_dict:
-        #     print("有数据")
-        # else:
-        #     print("没数据")
-
-        if response.text == "null":
-            print("暂时没有数据")
-            re_url = response.request.url
-            res_id = self.re_str(re_url)
-            print(res_id)
-            utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-            # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-            # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-            # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s,game_code='lq',status=4"
-            # self.conn.cursor.execute(sql1,(4,'lq',res_id,utime,utime))
-            self.conn.updata_data("update st_lq_result set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_lq_result_record set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_lq_competition set status=2  where match_id={}".format(res_id))
-            # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-
-            self.conn.commit()
-
-            # a.close_conn()
-
-    # def spider_opened(self, spider):
-
-
-    def spider_closed(self, spider):
-        print("我要关闭了")
-        self.conn.close_conn()
-
-
-        # new_datas = json.loads(response.text).get('eg', "")
-        # if new_datas:
-        #     new_data = new_datas.get("es", "")
-        #     result = new_data[0]
-        #     o_dic = result['o']
-        #     if response.text == "null"  or not o_dic:
-        #         print("没有数据")
-        # print(response.body)
-        # if response.text == "null":
-        #     print("这个网页没有数据的")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 207
scrapy_yzd/scrapy_yzd/spiders/hg3535_supplement.py

@@ -1,207 +0,0 @@
-# -*- coding: utf-8 -*-
-# import jmespath
-import jsonpath
-import scrapy
-import json
-from scrapy.http import  Request
-
-from scrapy_yzd.items import Hg3535Item, Today_all,Temaball
-
-
-class Hg3535Spider(scrapy.Spider):
-    name = 'hg3535_supplement'
-    allowed_domains = ['hg3535z.com']
-    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 足球滚球列url
-    custom_settings = {
-    "ITEM_PIPELINES": {
-        "scrapy_yzd.pipelines.Temaballpipeline": 300,
-    }
-}
-
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球url
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] #篮球
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=1&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 今日足球
-    def parse(self, response):
-        datas = json.loads(response.text)
-        # item = Today_all()
-        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        print(ids)
-        if ids:
-            ids = set(ids)
-            for i in ids:
-                urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-                print(urls)
-                yield Request(url=urls, callback=self.parse_other)
-
-        # ids = []
-        #页面没数据异常处理
-        # try:
-        #     results = datas['i-ot'][0]['egs']
-        # except KeyError:
-        #     results = []
-        # 第一
-        # for result in results:
-        #     league_id = result['c']['k'] #联赛id
-        #     league_name = result['c']['n'] #联赛名
-            # new_results = result['es'] # 取出列表嵌套字典
-            # 二
-            # for new_result in new_results:
-            #     ids = []
-                # game_id = str(new_result['i'][16]) #比赛id
-                # ids.append(game_id)
-                # if ids:
-                #     ids1 = set(ids)#去重
-
-
-
-    def parse_other(self, response):
-        print(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 = ""
-        if datas:
-            item = Temaball()
-            full_dict = {}
-            half_dict = {}
-            full_dict_rule = {}
-            half_dict_rule = {}
-            data_list = []
-            for data in datas:
-                try:
-                    new_data = data['pci']['ctid']
-                except:
-                    new_data = ""
-                pass
-                if new_data == 0:
-                    # 比赛id
-                    game_id = str(data['k'])
-                    data_list.append(game_id)
-                    # 球队1
-                    team_home = data['i'][0]
-                    data_list.append(team_home)
-                    # 球队2
-                    team_guest = data['i'][1]
-                    data_list.append(team_guest)
-                    # 数量(97>)
-                    number = data['i'][2]
-                    data_list.append(number)
-                    # 状态
-                    # zhuangtai = data['i'][3]
-
-                    # 日期
-                    data_game = data['i'][4]
-                    data_list.append(data_game)
-                    # 开赛时间
-                    time_game = data['i'][5]
-                    data_list.append(time_game)
-                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['game_id'] = data_list[0]
-            item['team_home'] = data_list[1]
-            item['team_guest'] = data_list[2]
-            item['number'] = data_list[3]
-            item['data_game'] = data_list[4]
-            item['time_game'] = data_list[5]
-            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 - 373
scrapy_yzd/scrapy_yzd/spiders/hg3535_wangqiu.py

@@ -1,373 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-
-import jsonpath
-import scrapy
-from scrapy.http import Request
-
-# from ..items import Lanqiu
-from scrapy_yzd.items import Wangqiu
-
-
-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 = [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 = [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 WangqiuSpider(scrapy.Spider):
-    name = "tennis"
-    allowed_domains = ['hg3535z.com']
-    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球滚球列url
-    custom_settings = {
-        "ITEM_PIPELINES": {
-            "scrapy_yzd.pipelines.Wangqiupipeline": 350,
-        }
-    }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        datas = json.loads(response.text)
-        # item = Today_all()
-        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        print(ids)
-        if ids:
-            ids = set(ids)
-            for i in ids:
-                urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-                print(urls)
-                yield Request(url=urls, callback=self.parse_other)
-
-
-    def parse_other(self,response):
-        new_datas = json.loads(response.text).get('eg', "")
-        try:
-            pt = response.meta['pt']
-        except:
-            pt = 0
-        item = Wangqiu()
-        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]
-            try:
-                time_game = result['sb']['ct']
-            except:
-                time_game = '01:00'
-            # time_game = '00:00:00'
-            # time_game = result.get('sb',"").get('ct',"")
-            # 队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]
-                concedes_dict['wq_concede_home'] = concedes[5]
-                concedes_dict_rule['wq_concede_guest'] = concedes[3]
-                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)
-
-# ----------------------------------------第一节让球分割线---------------------------------------------------------------------------
-
-            #第一节让球
-            try:
-                # 第一节让球
-                one_concedes = result['o']["ahs1"]["v"]
-                one_concede_home_rule,one_concede_home,one_concede_guest_rule,one_concede_guest= rangqiu_daxiao(inner=one_concedes)
-                concedes_dict_rule['wq_one_concede_home'] = ''.join(one_concede_home_rule)
-                concedes_dict['wq_one_concede_home'] = ''.join(one_concede_home)
-                concedes_dict_rule['wq_one_concede_guest'] = ''.join(one_concede_guest_rule)
-                concedes_dict['wq_one_concede_guest'] = ''.join(one_concede_guest)
-            except:
-                one_concede_guest = ""
-                one_concede_guest_rule = ""
-                one_concede_home = ""
-                one_concede_home_rule = ""
-                concedes_dict['wq_one_concede_home_rule'] = one_concede_home_rule
-                concedes_dict['wq_one_concede_home'] = one_concede_home
-                concedes_dict['wq_one_concede_guest_rule'] = one_concede_guest_rule
-                concedes_dict['wq_one_concede_guest'] = one_concede_guest
-
-# ----------------------------------------第二节让球分割线---------------------------------------------------------------------------
-
-            #第二节让球
-            # 第二节让球
-            try:
-                two_concedes = result['o']["ahs2"]["v"]
-                two_concede_home_rule,two_concede_home,two_concede_guest_rule,two_concede_guest = rangqiu_daxiao(inner=two_concedes)
-                concedes_dict_rule['wq_two_concede_home'] = ''.join(two_concede_home_rule)
-                concedes_dict['wq_two_concede_home'] = ''.join(two_concede_home)
-                concedes_dict_rule['wq_two_concede_guest'] = ''.join(two_concede_guest_rule)
-                concedes_dict['wq_two_concede_guest'] = ''.join(two_concede_guest)
-            except:
-                two_concede_guest = ""
-                two_concede_guest_rule = ""
-                two_concede_home = ""
-                two_concede_home_rule = ""
-                concedes_dict_rule['wq_two_concede_home'] = two_concede_home_rule
-                concedes_dict['wq_two_concede_home'] = two_concede_home
-                concedes_dict_rule['wq_two_concede_guest'] = two_concede_guest_rule
-                concedes_dict['wq_two_concede_guest'] = two_concede_guest
-
-
-
-
-
-
-
-# ---------------------------------------------------冠军  滚球是独赢----------------------------------------------------------------
-            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'] = ""
-
-            try: # 第二盘 独赢
-                kemps = result['o']["mls2"]["v"]
-                kemps_dict['wq_two_kemp_home'] = kemps[1]
-                kemps_dict['wq_two_kemp_guest'] = kemps[3]
-            except:
-                kemps_dict['wq_two_kemp_home'] = ""
-                kemps_dict["wq_two_kemp_guest"] = ""
-
-
-# ---------------------------------------------------让局---------------------------------------------------------------
-
-            bureaus_dict = {}
-            bureaus_dict_rule = {}
-            try:
-                bureaus = result['o']["ahfts"]["v"]
-                bureaus_dict_rule['wq_bureau_home'] = bureaus[1]# 添加前缀
-                bureaus_dict['wq_bureau_home'] = bureaus[5]#
-                bureaus_dict_rule['wq_bureau_guest'] = bureaus[3]#
-                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] #添加前缀wp
-                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'] = ""
-
-            # 第一节盘
-            try:
-                one_total_sizes = result['o']["ous1"]["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_number_dict_rule["wq_one_total_sizes_big"] = ''.join(one_total_sizes_big_rule)
-                total_number_dict["wq_one_total_sizes_big"] = ''.join(one_total_sizes_big)
-                total_number_dict_rule["wq_one_total_sizes_small"] = ''.join(one_total_sizes_small_rule)
-                total_number_dict["wq_one_total_sizes_small"] = ''.join(one_total_sizes_small)
-            except:
-                one_total_sizes_big_rule = ""
-                one_total_sizes_big = ""
-                one_total_sizes_small_rule = ""
-                one_total_sizes_small = ""
-                total_number_dict_rule["wq_one_total_sizes_big"] = ''.join(one_total_sizes_big_rule)
-                total_number_dict["wq_one_total_sizes_big"] = ''.join(one_total_sizes_big)
-                total_number_dict_rule["wq_one_total_sizes_small"] = ''.join(one_total_sizes_small_rule)
-                total_number_dict["wq_one_total_sizes_small"] = ''.join(one_total_sizes_small)
-
-            # 第二节盘
-            try:
-                two_total_sizes = result['o']["ous2"]["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_number_dict_rule["wq_two_total_sizes_big"] = two_total_sizes_big_rule
-                total_number_dict["wq_two_total_sizes_big"] = "".join(two_total_sizes_big)
-                total_number_dict_rule["wq_two_total_sizes_small"] = "".join(two_total_sizes_small_rule)
-                total_number_dict["wq_two_total_sizes_small"] = "".join(two_total_sizes_small)
-            except:
-                two_total_sizes_big_rule = ""
-                two_total_sizes_big = ""
-                two_total_sizes_small_rule = ""
-                two_total_sizes_small = ""
-                total_number_dict_rule["wq_two_total_sizes_big"] = two_total_sizes_big_rule
-                total_number_dict["wq_two_total_sizes_big"] = ''.join(two_total_sizes_big)
-                total_number_dict_rule["wq_two_total_sizes_small"] = ''.join(two_total_sizes_small_rule)
-                total_number_dict["wq_two_total_sizes_small"] = ''.join(two_total_sizes_small)
-
-
-            # 第三节盘
-            try:
-                three_total_sizes = result['o']["ous3"]["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_number_dict_rule["wq_three_total_sizes_big"] = ''.join(three_total_sizes_big_rule)
-                total_number_dict["wq_three_total_sizes_big"] = three_total_sizes_big
-                total_number_dict_rule["wq_three_total_sizes_small"] = ''.join(three_total_sizes_small_rule)
-                total_number_dict["wq_three_total_sizes_small"] = ''.join(three_total_sizes_small)
-            except:
-                three_total_sizes_big_rule = ""
-                three_total_sizes_big = ""
-                three_total_sizes_small_rule = ""
-                three_total_sizes_small = ""
-                total_number_dict_rule["wq_three_total_sizes_big"] = ''.join(three_total_sizes_big_rule)
-                total_number_dict["wq_three_total_sizes_big"] = three_total_sizes_big
-                total_number_dict_rule["wq_three_total_sizes_small"] = ''.join(three_total_sizes_small_rule)
-                total_number_dict["wq_three_total_sizes_small"] = three_total_sizes_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_even_odd
-                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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 231
scrapy_yzd/scrapy_yzd/spiders/hg3535_wq_status.py

@@ -1,231 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-
-import jsonpath
-import scrapy
-import time
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-from scrapy_yzd.items import Lanqiu, Bangqiustatus, Lanqiustatus, Wanqiustatus
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class BangqiuSpider(scrapy.Spider):
-    name = "wangqiu_status"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    custom_settings = {
-        "ITEM_PIPELINES": {
-            'scrapy_yzd.pipelines.WangqiuStatuspipeline':200,
-        }
-    }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        datas = json.loads(response.text)
-        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        item = Wanqiustatus()
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-        # zuqiu_total = {}
-        bangqiu_status_list = []
-        if ids:
-            ids = set(ids)
-            for i in ids:
-                zuqiu = {}
-                zuqiu['match_id'] = i
-                zuqiu['create_time'] = utime
-                zuqiu['status'] = 1
-                zuqiu['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['match_id'] = i
-                # item['create_time'] = utime
-                # item['status'] = 1
-                # item['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['zuqiu_toal'] = zuqiu
-                bangqiu_status_list.append(zuqiu)
-            item["wangqiu_total"] = bangqiu_status_list
-            yield item
-
-        # urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0''http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0','http://hg3535z.com/odds2/d/getodds?sid=4&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
-        # for url in urls:
-        #     yield Request(url=url, callback=self.parse)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 321
scrapy_yzd/scrapy_yzd/spiders/hg3535_wq_status_up.py

@@ -1,321 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import jsonpath
-import scrapy
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-import re
-from scrapy.xlib.pydispatch import dispatcher
-from scrapy import signals
-
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        # self.cursor = self.conn.cursor()
-
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class LanqiuSpider(scrapy.Spider):
-    def __init__(self):
-        super(LanqiuSpider).__init__()
-        #信号量
-        # dispatcher.connect(self.spider_opened, signals.spider_opened)
-        dispatcher.connect(self.spider_closed, signals.spider_closed)
-        # self.conn = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-        self.conn = SqlConn(sql_name='postgresql',host='192.168.2.200',port=10432,user='kaiyou',password='123456',database='kaiyou')
-
-
-
-    name = "wangqiu_status_update"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    # custom_settings = {
-    #     "ITEM_PIPELINES": {
-    #         'scrapy_yzd.pipelines.BallStatuspipeline':1,
-    #     }
-    # }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # a.test_conn()
-        b = self.conn.get_data("select match_id from st_ball_status where ball_type='网球'")
-        d = list(itertools.chain(*b))
-        # yield Request(url='http://hg3535z.com/odds2/d/getamodds?eid=3147927&iip=true&ubt=am&isp=false',callback=self.parse_each)
-        for i in d:
-            urls = 'https://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-            yield Request(url=urls,callback=self.parse_each)
-
-    #取得url中的id字段
-    def re_str(self,url_str):
-        a = (re.findall(r"eid=(.+?)&",url_str))
-        result = "".join(a)
-        return result
-
-    def parse_each(self,response):
-        # print("URL: " + response.request.url)
-        if response.text != "null":
-            res = json.loads(response.text)
-            # res = {"i":['false',1,3149430,4,2,"sh",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"28 / 04","99:00","下半场",'false','true',"足球",0],"eg":{"c":{"k":27078,"n":"罗马尼亚乙组联赛"},"es":[{"dbg":'true',"egid":0,"g":"","i":["阿格斯","法乌尔","1","True","28 / 04","","1","False","0","0","0","1","FT","","","",0,"0","1",0,"False"],"ibs":'true',"ibsc":'true',"lcd":{"lcpid":5,"ilup":'false',"lcid":3147921,"p":0},"k":3147921,"o":{},"pci":{"ctid":0},"egn":""},{"dbg":'false',"egid":0,"g":"","i":["阿格斯-角球数","法乌尔-角球数","1","True","28 / 04","99:00","1","False","0","0","4","2","下半场","Second Half","","",0,"","",0,"False"],"ibs":'true',"ibsc":'false',"k":3149430,"o":{"oe":{"s":192,"v":["o3239030643","0.00","o3239030644","0.00"],"n":"角球:滚球 单 / 双"}},"pci":{"ctid":1,"ctn":"角球"},"egn":""}]},"ot":2,"sc":{"3147921":{"a":1,"h":0},"3149430":{"a":2,"h":4}},"v":567862}
-            # res1 = jsonpath.jsonpath(res,'$..eg..es[0]..o')
-            res1 = jsonpath.jsonpath(res,'$..eg..es[:]..o')
-            if len(res1) > 1:
-                print("这是有角球啊")
-                o_dict0 = res1[0]  # 递归取o字典
-                o_dict1 = res1[1]
-                re_url = response.request.url
-                res_id = self.re_str(re_url)
-                print("我是角球id是")
-                print(res_id)
-                if o_dict0 or o_dict1:
-                    print("这不是个空字典")
-                    print("我不做任何操作的啊")
-                    # re_url = response.request.url
-                    # res_id = self.re_str(re_url)
-                    # print(res_id)
-                    # utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s"
-                    # self.conn.cursor.execute(sql1,(4,'zq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    # self.conn.commit()
-            else:
-                o_dict0 = res1[0]
-                if not o_dict0:
-                    print("这是空字典我要改状态")
-                    re_url = response.request.url
-                    res_id = self.re_str(re_url)
-                    print(res_id)
-                    utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s,game_code='lq',status=4"
-                    self.conn.updata_data("update st_wq_result set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_wq_result_record set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_wq_competition set status=2  where match_id={}".format(res_id))
-                    # self.conn.cursor.execute(sql1,(4,'lq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    self.conn.commit()
-        # if o_dict:
-        #     print("有数据")
-        # else:
-        #     print("没数据")
-
-        if response.text == "null":
-            print("暂时没有数据")
-            re_url = response.request.url
-            res_id = self.re_str(re_url)
-            print(res_id)
-            utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-            # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-            # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-            # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s,game_code='lq',status=4"
-            # self.conn.cursor.execute(sql1,(4,'lq',res_id,utime,utime))
-            self.conn.updata_data("update st_wq_result set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_wq_result_record set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_wq_competition set status=2  where match_id={}".format(res_id))
-            # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-
-            self.conn.commit()
-
-            # a.close_conn()
-
-    # def spider_opened(self, spider):
-
-
-    def spider_closed(self, spider):
-        print("我要关闭了")
-        self.conn.close_conn()
-
-
-        # new_datas = json.loads(response.text).get('eg', "")
-        # if new_datas:
-        #     new_data = new_datas.get("es", "")
-        #     result = new_data[0]
-        #     o_dic = result['o']
-        #     if response.text == "null"  or not o_dic:
-        #         print("没有数据")
-        # print(response.body)
-        # if response.text == "null":
-        #     print("这个网页没有数据的")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 231
scrapy_yzd/scrapy_yzd/spiders/hg3535_zq_status.py

@@ -1,231 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-
-import jsonpath
-import scrapy
-import time
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-from scrapy_yzd.items import  Zuqiustatus
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class LanqiuSpider(scrapy.Spider):
-    name = "ball_status"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    custom_settings = {
-        "ITEM_PIPELINES": {
-            'scrapy_yzd.pipelines.BallStatuspipeline':200,
-        }
-    }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        datas = json.loads(response.text)
-        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        item = Zuqiustatus()
-        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-        # zuqiu_total = {}
-        zuqiu_status_list = []
-        if ids:
-            ids = set(ids)
-            for i in ids:
-                zuqiu = {}
-                zuqiu['match_id'] = i
-                zuqiu['create_time'] = utime
-                zuqiu['status'] = 1
-                zuqiu['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['match_id'] = i
-                # item['create_time'] = utime
-                # item['status'] = 1
-                # item['ball_type'] = datas['i-ot'][0]['s']['n']
-                # item['zuqiu_toal'] = zuqiu
-                zuqiu_status_list.append(zuqiu)
-            item["zuqiu_total"] = zuqiu_status_list
-            yield item
-
-        # urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0''http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0','http://hg3535z.com/odds2/d/getodds?sid=4&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
-        # for url in urls:
-        #     yield Request(url=url, callback=self.parse)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 325
scrapy_yzd/scrapy_yzd/spiders/hg3535_zq_status_up.py

@@ -1,325 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import jsonpath
-import scrapy
-from scrapy.http import Request
-import psycopg2
-import time
-from functools import wraps
-from contextlib import contextmanager
-import psycopg2.extras
-
-from scrapy.conf import settings
-import json
-from datetime import datetime
-from datetime import date
-import itertools
-import re
-from scrapy.xlib.pydispatch import dispatcher
-from scrapy import signals
-
-
-
-# 测试一个函数的运行时间,使用方式:在待测函数直接添加此修饰器
-def timethis(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        start = time.perf_counter()
-        r = func(*args, **kwargs)
-        end = time.perf_counter()
-        print('\n============================================================')
-        print('{}.{} : {}'.format(func.__module__, func.__name__, end - start))
-        print('============================================================\n')
-        return r
-    return wrapper
-
-
-# 测试一段代码运行的时间,使用方式:上下文管理器with
-# with timeblock('block_name'):
-#     your_code_block...
-@contextmanager
-def timeblock(label='Code'):
-    start = time.perf_counter()
-    try:
-        yield
-    finally:
-        end = time.perf_counter()
-        print('==============================================================')
-        print('{} run time: {}'.format(label, end - start))
-        print('==============================================================')
-
-
-class SqlConn():
-    '''
-    连接数据库,以及进行一些操作的封装
-    '''
-    sql_name = ''
-    database = ''
-    user = ''
-    password = ''
-    port = 0
-    host = ''
-
-    # 创建连接、游标
-    def __init__(self, *args, **kwargs):
-        if kwargs.get("sql_name"):
-            self.sql_name = kwargs.get("sql_name")
-        if kwargs.get("database"):
-            self.database = kwargs.get("database")
-        if kwargs.get("user"):
-            self.user = kwargs.get("user")
-        if kwargs.get("password"):
-            self.password = kwargs.get("password")
-        if kwargs.get("port"):
-            self.port = kwargs.get("port")
-        if kwargs.get("host"):
-            self.host = kwargs.get("host")
-
-        if not (self.host and self.port and self.user and
-                self.password and self.database):
-            raise Warning("conn_error, missing some params!")
-
-        sql_conn = {
-                    'postgresql': psycopg2,
-                    }
-
-        self.conn = sql_conn[self.sql_name].connect(host=self.host,
-                                                    port=self.port,
-                                                    user=self.user,
-                                                    password=self.password,
-                                                    database=self.database,
-                                                    )
-        self.cursor = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-        # self.cursor = self.conn.cursor()
-
-        if not self.cursor:
-            raise Warning("conn_error!")
-
-    # 测试连接
-    def test_conn(self):
-        if self.cursor:
-            print("conn success!")
-        else:
-            print('conn error!')
-
-    # 单条语句的并提交
-    def execute(self, sql_code):
-        self.cursor.execute(sql_code)
-        self.conn.commit()
-
-    # 单条语句的不提交
-    def execute_no_conmmit(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 构造多条语句,使用%s参数化,对于每个list都进行替代构造
-    def excute_many(self, sql_base, param_list):
-        self.cursor.executemany(sql_base, param_list)
-
-    # 批量执行(待完善)
-    def batch_execute(self, sql_code):
-        pass
-
-    # 获取数据
-    def get_data(self, sql_code, count=0):
-        self.cursor.execute(sql_code)
-        if int(count):
-            return self.cursor.fetchmany(count)
-        else:
-            return self.cursor.fetchall()
-
-    # 更新数据
-    def updata_data(self, sql_code):
-        self.cursor.execute(sql_code)
-
-    # 插入数据
-    def insert_data(self, sql_code):
-        self.cursor(sql_code)
-
-    # 滚动游标
-    def cursor_scroll(self, count, mode='relative'):
-        self.cursor.scroll(count, mode=mode)
-
-    # 提交
-    def commit(self):
-        self.conn.commit()
-
-    # 回滚
-    def rollback(self):
-        self.conn.rollback()
-
-    # 关闭连接
-    def close_conn(self):
-        self.cursor.close()
-        self.conn.close()
-
-class ComplexEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, datetime):
-            return obj.strftime('%Y-%m-%d %H:%M:%S')
-        elif isinstance(obj, date):
-            return obj.strftime('%Y-%m-%d')
-        else:
-            return json.JSONEncoder.default(self, obj)
-
-
-
-
-
-
-
-
-class LanqiuSpider(scrapy.Spider):
-    def __init__(self):
-        super(LanqiuSpider).__init__()
-        #信号量
-        # dispatcher.connect(self.spider_opened, signals.spider_opened)
-        dispatcher.connect(self.spider_closed, signals.spider_closed)
-        # self.conn = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
-        # self.conn = SqlConn(sql_name='postgresql',host='192.168.2.200',port=10432,user='kaiyou',password='123456',database='kaiyou')
-        self.conn = SqlConn(sql_name='postgresql',host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"],password=settings["POST_PASSWORD"],database=settings["POST_DATABASE"])
-
-
-
-    name = "ball_status_update"
-    allowed_domains = ['hg3535z.com']
-    #sid要改为1 足球 现在测试改为4
-    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
-    # custom_settings = {
-    #     "ITEM_PIPELINES": {
-    #         'scrapy_yzd.pipelines.BallStatuspipeline':1,
-    #     }
-    # }
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
-    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
-
-    def parse(self, response):
-        # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-        # a.test_conn()
-        b = self.conn.get_data("select match_id from st_ball_status where ball_type='足球'")
-        d = list(itertools.chain(*b))
-        # yield Request(url='http://hg3535z.com/odds2/d/getamodds?eid=3147927&iip=true&ubt=am&isp=false',callback=self.parse_each)
-        for i in d:
-            urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-            yield Request(url=urls,callback=self.parse_each)
-
-    #取得url中的id字段
-    def re_str(self,url_str):
-        a = (re.findall(r"eid=(.+?)&",url_str))
-        result = "".join(a)
-        return result
-
-    def parse_each(self,response):
-        # print("URL: " + response.request.url)
-        if response.text != "null":
-            res = json.loads(response.text)
-            # res = {"i":['false',1,3149430,4,2,"sh",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"28 / 04","99:00","下半场",'false','true',"足球",0],"eg":{"c":{"k":27078,"n":"罗马尼亚乙组联赛"},"es":[{"dbg":'true',"egid":0,"g":"","i":["阿格斯","法乌尔","1","True","28 / 04","","1","False","0","0","0","1","FT","","","",0,"0","1",0,"False"],"ibs":'true',"ibsc":'true',"lcd":{"lcpid":5,"ilup":'false',"lcid":3147921,"p":0},"k":3147921,"o":{},"pci":{"ctid":0},"egn":""},{"dbg":'false',"egid":0,"g":"","i":["阿格斯-角球数","法乌尔-角球数","1","True","28 / 04","99:00","1","False","0","0","4","2","下半场","Second Half","","",0,"","",0,"False"],"ibs":'true',"ibsc":'false',"k":3149430,"o":{"oe":{"s":192,"v":["o3239030643","0.00","o3239030644","0.00"],"n":"角球:滚球 单 / 双"}},"pci":{"ctid":1,"ctn":"角球"},"egn":""}]},"ot":2,"sc":{"3147921":{"a":1,"h":0},"3149430":{"a":2,"h":4}},"v":567862}
-            # res1 = jsonpath.jsonpath(res,'$..eg..es[0]..o')
-            res1 = jsonpath.jsonpath(res,'$..eg..es[:]..o')
-            if len(res1) > 1:
-                print("这是有角球啊")
-                o_dict0 = res1[0]  # 递归取o字典
-                o_dict1 = res1[1]
-                re_url = response.request.url
-                res_id = self.re_str(re_url)
-                print("我是角球id是")
-                print(res_id)
-                if o_dict0 or o_dict1:
-                    print("这不是个空字典")
-                    print("我不做任何操作的啊")
-                    # re_url = response.request.url
-                    # res_id = self.re_str(re_url)
-                    # print(res_id)
-                    # utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    # self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s"
-                    # self.conn.cursor.execute(sql1,(4,'zq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    # self.conn.commit()
-            else:
-                o_dict0 = res1[0]
-                if not o_dict0:
-                    print("这是空字典我要改状态")
-                    re_url = response.request.url
-                    res_id = self.re_str(re_url)
-                    print(res_id)
-                    utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                    # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-                    self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-                    # sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s"
-                    self.conn.updata_data("update st_zq_result set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_zq_result_record set status=2  where match_id={}".format(res_id))
-                    self.conn.updata_data("update st_zq_competition set status=2  where match_id={}".format(res_id))
-
-                    # self.conn.cursor.execute(sql1,(4,'zq',res_id,utime,utime))
-                    # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-                    self.conn.commit()
-        # if o_dict:
-        #     print("有数据")
-        # else:
-        #     print("没数据")
-
-        if response.text == "null":
-            print("暂时没有数据")
-            re_url = response.request.url
-            res_id = self.re_str(re_url)
-            print(res_id)
-            utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-            # a = SqlConn(sql_name='postgresql',host='127.0.0.1',port=5432,user='postgres',password='9998877',database='postgres')
-            self.conn.updata_data("update st_ball_status  set status=0, update_time='{0}' where match_id={1}".format(utime,res_id))
-            sql1 = "insert into comendnotice(status, game_code, match_id,done_time) values (%s,%s, %s, %s) on conflict(match_id) do update set done_time = %s"
-            self.conn.cursor.execute(sql1,(4,'zq',res_id,utime,utime))
-            self.conn.updata_data("update st_zq_result set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_zq_result_record set status=2  where match_id={}".format(res_id))
-            self.conn.updata_data("update st_zq_competition set status=2  where match_id={}".format(res_id))
-            # cursor.execute(sql1, (match_id, create_time,staus,update_time, ball_type,update_time))
-
-            self.conn.commit()
-
-            # a.close_conn()
-
-    # def spider_opened(self, spider):
-
-
-    def spider_closed(self, spider):
-        print("我要关闭了")
-        self.conn.close_conn()
-
-
-        # new_datas = json.loads(response.text).get('eg', "")
-        # if new_datas:
-        #     new_data = new_datas.get("es", "")
-        #     result = new_data[0]
-        #     o_dic = result['o']
-        #     if response.text == "null"  or not o_dic:
-        #         print("没有数据")
-        # print(response.body)
-        # if response.text == "null":
-        #     print("这个网页没有数据的")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 833
scrapy_yzd/scrapy_yzd/spiders/hg3535_zuqiu.py

@@ -1,833 +0,0 @@
-# -*- coding: utf-8 -*-
-# import jmespath
-import jsonpath
-import scrapy
-import json
-# from scrapy.http import  Request
-
-from scrapy_yzd.items import  Today_all
-
-
-def reverli(li=[]):
-    if not li:
-        li = []
-    for i in li:
-        if isinstance(i,int):
-            res1 = "".join('%s' %i)
-            return res1
-    res = "".join(li)
-    return res
-
-odd_nums = [ i for i in range(1,101) if i %2 ==1]
-
-
-
-def dict_get(dict1, objkey, default):
-    tmp = dict1
-    for k, v in tmp.items():
-        # print(k,v)
-        if k == objkey:
-            return v
-        elif isinstance(v, dict):
-            ret = dict_get(v, objkey, default)
-            if ret is not default:
-                return ret
-        else:
-            if isinstance(v, list):
-                for i in v:
-                    ret = dict_get(i, objkey, default)
-                    if ret is not default:
-                        return ret
-    return default
-
-class Hg3535Spider(scrapy.Spider):
-    name = 'hg3535'
-    allowed_domains = ['hg3535z.com']
-    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 足球滚球列url
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球url
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] #篮球
-    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=1&ubt=am&pn=0&sb=2&dc=null&pid=0']
-    custom_settings = {
-        "ITEM_PIPELINES": {
-            "scrapy_yzd.pipelines.ScrapyYzdPipeline": 100,
-        }
-    }
-
-
-    def parse(self, response):
-        datas = json.loads(response.text)
-        item = Today_all()
-        ids = []
-        #页面没数据异常处理
-        try:
-            results = datas['i-ot'][0]['egs']
-        except KeyError:
-            results = []
-        #4个字典
-        concedelist = {}
-        oddevenlist = {}
-        capotlist = {}
-        totalgoallist = {}
-        halffulllist = {}
-        bodanlist = {}
-        firstlastballlist = {}
-        #第一
-        for result in results:
-            league_id = result['c']['k'] #联赛id
-            league_name = result['c']['n'] #联赛名
-            new_results = result['es'] # 取出列表嵌套字典
-            #二
-            for new_result in new_results:
-                # ids = []
-                game_id = str(new_result['i'][16]) #比赛id
-                # ids.append(game_id)
-                # if ids:
-                #     ids1 = set(ids)#去重
-                #     for i in ids1:
-                #         urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-                #         print(urls)
-                #         yield Request(url=urls, callback=self.parse_other)
-            #     if ids:
-            #         ids1 = set(ids)#去重
-            #         for i in ids1:
-            #             urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-            #             print(urls)
-            #             yield Request(url=urls, callback=self.parse_each)
-                team_home = new_result['i'][0]  # 球队一
-                team_guest = new_result['i'][1] # 球队二
-                number = new_result['i'][2] # 数量
-                data_game = new_result['i'][4] #  日期
-                time_game  = new_result['i'][5] # 开赛时间
-                score_home = new_result['i'][10]  # 队一分数
-                score_guest = new_result['i'][11] # 队二分数
-                half_way = new_result['i'][12] #下半场
-                corner_ball = new_result['pci'].get('ctn',"") #角球
-                status = new_result['i'][3] # 状态值
-
-                # 全场让球 concede
-                concede_size = {}
-                concedes = new_result['o'].get('ah', "")
-                if concedes:
-                    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)
-                            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_rule
-                    concede_size["concede_home_rule"] = concede_home_rule
-                    # concede_home
-                    concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 1]
-                    concede_size["concede_home"] = concede_home
-                    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_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)
-                            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_size["concede_guest_rule"] = concede_guest_rule
-                    # concede_guest
-                    concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 1]
-                    concede_size["concede_guest"] = concede_guest
-                else:
-                    concede_size["concede_guest"] = ""
-                    concede_size["concede_guest_rule"] = ""
-                    concede_size["concede_home"] = ""
-                    concede_size["concede_home_rule"] = ""
-
-                # 上半场让球half_concede  滚球不存在
-                half_concedes = new_result['o'].get('ah1st', "")
-                if half_concedes:
-                    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 = []
-                    # 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_size["half_concede_home_rule"] = half_concede_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]
-                    concede_size["half_concede_home"] = half_concede_home
-                    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_size["half_concede_guest_rule"] = half_concede_guest_rule
-                    # concede_guest
-                    half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 == 1]
-                    concede_size["half_concede_guest"] = half_concede_guest
-                else:
-                    concede_size["half_concede_home_rule"] = ""
-                    concede_size["half_concede_home"] = ""
-                    concede_size["half_concede_guest_rule"] = ""
-                    concede_size["half_concede_guest"] = ""
-
-                # 全场大小size
-                sizes = new_result['o'].get('ou', "")
-                if sizes:
-                    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]
-                    concede_size["size_home_rule"] = size_home_rule
-                    # size_home
-                    size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 1]
-                    concede_size["size_home"] = size_home
-                    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]
-                    concede_size["size_guest_rule"] = size_guest_rule
-                    # csize_guest
-                    size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 1]
-                    concede_size["size_guest"] = size_guest
-                else:
-                    concede_size["size_guest"] = ""
-                    concede_size["size_guest_rule"] = ""
-                    concede_size["size_home"] = ""
-                    concede_size["size_home_rule"] = ""
-
-
-
-                # 上半场大小 half_size
-                half_sizes = new_result['o'].get('ou1st',"")
-                if half_sizes:
-                    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]
-                    concede_size["half_size_home_rule"] = half_size_home_rule
-                    # half_size_home
-                    half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 1]
-                    concede_size["half_size_home"] =half_size_home
-                    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]
-                    concede_size["half_size_guest_rule"] = half_size_guest_rule
-                    # half_size_guest
-                    half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if i % 2 == 1]
-                    concede_size["half_size_guest"] = half_size_guest
-                else:
-                    concede_size["half_size_guest"] = ""
-                    concede_size["half_size_guest_rule"] = ""
-                concede_size["half_size_home"] = ""
-                concede_size["half_size_home_rule"] = ""
-                concede_size['league_id'] = league_id
-                concede_size['league_name'] = league_name
-                concede_size['game_id'] = game_id
-                concede_size['team_home'] = team_home
-                concede_size['team_guest'] = team_guest
-                concede_size['number'] = number
-                concede_size['data_game'] = data_game
-                concede_size['time_game'] = time_game
-                concede_size['corner_ball'] = corner_ball
-                concede_size['score_home'] = score_home
-                concede_size['score_guest'] = score_guest
-                concede_size['half_way'] = half_way
-                concede_size['status'] = status
-                concedelist[game_id] = concede_size
-                # 让球大小盘
-                item["concede_size"] = concedelist
-
-                 #全场独赢
-                capot = {}
-                # 全场独赢capot
-                capots = new_result['o'].get('1x2', "")
-                if capots:
-                    new_capots = [capots[i] for i in range(len(capots)) if i % 2 == 1]
-                    capot["capot_home"] = new_capots[0]
-                    capot["capot_guest"] = new_capots[1]
-                    capot["capot_dogfall"] = new_capots[2]
-                else:
-                    capot["capot_home"] = ""
-                    capot["capot_guest"] = ""
-                    capot["capot_dogfall"] = ""
-
-                #上半场独赢capot
-                half_capots = new_result['o'].get('1x21st', "")
-                if half_capots:
-                    new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
-                    capot["half_capot_home"] = new_half_capots[0]
-                    capot["half_capot_guest"] = new_half_capots[1]
-                    capot["half_capot_dogfall"] = new_half_capots[2]
-                else:
-                    capot["half_capot_home"] = ""
-                    capot["half_capot_guest"] = ""
-                    capot["half_capot_dogfall"] = ""
-                capot['league_id'] = league_id
-                capot['league_name'] = league_name
-                capot['game_id'] = game_id
-                capot['team_home'] = team_home
-                capot['team_guest'] = team_guest
-                capot['number'] = number
-                capot['data_game'] = data_game
-                capot['time_game'] = time_game
-                capot['corner_ball'] = corner_ball
-                capot['score_home'] = score_home
-                capot['score_guest'] = score_guest
-                capot['half_way'] = half_way
-                capot['status'] = status
-                capotlist[game_id] = capot
-                # 独赢
-                item["capot"] = capotlist
-
-
-
-                # 全场入球:单/双
-                odd_even = {}
-                # 全场入球:单/双 odd_even
-                odd_evens = new_result['o'].get('oe',"")
-                if odd_evens:
-                    new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 == 1]
-                    odd_even["odd_even_odd"] = new_odd_evens[0] #全场单
-                    odd_even["odd_even_even"] = new_odd_evens[1] #全场双
-                else:
-                    odd_even["odd_even_odd"] = ""
-                    odd_even["odd_even_even"] = ""
-                # 半场入球:单/双 half_odd_even
-                half_odd_evens = new_result['o'].get('oe1st',"")
-                if half_odd_evens:
-                    new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 == 1]
-                    odd_even["half_odd_even_odd"] = new_half_odd_evens[0] #上半场单
-                    odd_even["half_odd_even_even"] = new_half_odd_evens[1] # 上半场双
-                else:
-                    odd_even["half_odd_even_odd"] = ""  #上半场单
-                    odd_even["half_odd_even_even"] = "" #上半场双
-                odd_even['league_id'] = league_id
-                odd_even['league_name'] = league_name
-                odd_even['game_id'] = game_id
-                odd_even['team_home'] = team_home
-                odd_even['team_guest'] = team_guest
-                odd_even['number'] = number
-                odd_even['data_game'] = data_game
-                odd_even['time_game'] = time_game
-                odd_even['corner_ball'] = corner_ball
-                odd_even['score_home'] = score_home
-                odd_even['score_guest'] = score_guest
-                odd_even['half_way'] = half_way
-                odd_even['status'] = status
-                oddevenlist[game_id] = odd_even
-                # 入球数-单双
-                item["odd_even"] = oddevenlist
-
-
-                # 全场总进球 total_goal
-                total_goal = {}
-                total_goals = new_result['o'].get('tg', "")
-                if total_goals:
-                    new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 == 1]
-                    total_goal["total_goal_zero"] = new_total_goals[0]
-                    total_goal["total_goal_two"] = new_total_goals[1]
-                    total_goal["total_goal_four"] = new_total_goals[2]
-                    total_goal["total_goal_seven"] = new_total_goals[3]
-                else:
-                    total_goal["total_goal_zero"] = ""
-                    total_goal["total_goal_two"] = ""
-                    total_goal["total_goal_four"] = ""
-                    total_goal["total_goal_seven"] = ""
-
-                # 总进球上半场 half_total_goal
-                half_total_goals = new_result['o'].get('tg1st', "")
-                if half_total_goals:
-                    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"] = new_half_total_goals[0]
-                    total_goal["half_total_goal_one"] = new_half_total_goals[1]
-                    total_goal["half_total_goal_two"] = new_half_total_goals[2]
-                    total_goal["half_total_goal_three"] = new_half_total_goals[3]
-                else:
-                    total_goal["half_total_goal_zero"] = ""
-                    total_goal["half_total_goal_one"] = ""
-                    total_goal["half_total_goal_two"] = ""
-                    total_goal["half_total_goal_three"] = ""
-                total_goal['league_id'] = league_id
-                total_goal['league_name'] = league_name
-                total_goal['game_id'] = game_id
-                total_goal['team_home'] = team_home
-                total_goal['team_guest'] = team_guest
-                total_goal['number'] = number
-                total_goal['data_game'] = data_game
-                total_goal['time_game'] = time_game
-                total_goal['corner_ball'] = corner_ball
-                total_goal['score_home'] = score_home
-                total_goal['score_guest'] = score_guest
-                total_goal['status'] = status
-                total_goal['half_way'] = half_way
-                totalgoallist[game_id] = total_goal
-                #总入球
-                item["total_goal"] = totalgoallist
-
-
-
-
-                # 早盘 半场/全场
-                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"]
-                half_fulls = new_result['o'].get('hf', "")
-                if half_fulls:
-                    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] = new_half_fulls[index]
-                else:
-                    for index, value in enumerate(new_lists):
-                        half_full[value] = ""
-                half_full['league_id'] = league_id
-                half_full['league_name'] = league_name
-                half_full['game_id'] = game_id
-                half_full['team_home'] = team_home
-                half_full['team_guest'] = team_guest
-                half_full['number'] = number
-                half_full['data_game'] = data_game
-                half_full['time_game'] = time_game
-                half_full['corner_ball'] = corner_ball
-                half_full['score_home'] = score_home
-                half_full['score_guest'] = score_guest
-                half_full['half_way'] = half_way
-                half_full['status'] = status
-                halffulllist[game_id] = half_full
-                #半场/全场
-                item["half_full"] = halffulllist
-
-
-
-                # 波胆
-                bodan = {}
-                bodan_data = {}
-                half_bodan_data = {}
-                bodans = new_result['o'].get('cs', "")
-                if bodans:
-                    one_list = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two","bodan_home_four_zero","bodan_home_four_one","bodan_home_four_two","bodan_home_four_three"]
-                    two_list = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two","bodan_guest_four_zero","bodan_guest_four_one","bodan_guest_four_two","bodan_guest_four_three"]
-                    three_list = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_three_three","bodan_dogfall_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] = bodan_home[index]
-                    # 客队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] = bodan_guest[y]
-                    bodan_dogfall = new_bodans[-7:-2]
-                    for a, b in enumerate(three_list):
-                        bodan_data[b] = bodan_dogfall[a]
-                    # 其他bodan_other
-                    bodan_data['bodan_other'] = new_bodans[-1]
-                    bodan['bodan'] = bodan_data
-                else:
-                    bodan["bodan"] = ""
-                half_bodans = new_result['o'].get('cs1st', "")
-                if half_bodans:
-                        new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 == 1]
-                        new_one = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two"]
-                        new_two = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two"]
-                        new_three = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_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):
-                            half_bodan_data[t] = half_bodan_home[index]
-                        # 队2
-                        half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 1]
-                        for y, z in enumerate(new_two):
-                            half_bodan_data[z] = half_bodan_guest[y]
-                        # 和/平
-                        half_bodan_dogfall = new_half_bodans[-6:-2]
-                        for a, b in enumerate(new_three):
-                            half_bodan_data[b] = half_bodan_dogfall[a]
-                        # 其他
-                        half_bodan_data['bodan_other'] = new_half_bodans[-1]
-                        bodan["half_bodan"] = half_bodan_data
-                else:
-                    bodan['half_bodan'] = ""
-                bodan['league_id'] = league_id
-                bodan['league_name'] = league_name
-                bodan['game_id'] = game_id
-                bodan['team_home'] = team_home
-                bodan['team_guest'] = team_guest
-                bodan['number'] = number
-                bodan['data_game'] = data_game
-                bodan['time_game'] = time_game
-                bodan['corner_ball'] = corner_ball
-                bodan['status'] = status
-                bodan['score_home'] = score_home
-                bodan['score_guest'] = score_guest
-                bodan['half_way'] = half_way
-                bodanlist[game_id] = bodan
-                item["bodan"] = bodanlist
-
-
-
-
-
-                # 早盘 最先/最后进球
-                first_last_ball = {}
-                # 早盘 最先/最后进球 最先进球
-                first_balls = new_result['o'].get('ttslast', "")
-                if first_balls:
-                    first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 == 1]
-                    first_last_ball['first_ball_home'] = first_ball[0]
-                    first_last_ball['first_ball_guest'] = first_ball[1]
-                else:
-                    first_last_ball['first_ball_home'] = ""
-                    first_last_ball['first_ball_guest'] = ""
-                # 早盘 最先/最后进球 最后进球
-                last_balls = new_result['o'].get('tts1st', "")
-                if last_balls:
-                    last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 == 1]
-                    first_last_ball['last_ball_home'] = last_ball[0]
-                    first_last_ball['last_ball_guest'] = last_ball[1]
-                    first_last_ball['not_ball'] = last_ball[2]
-                else:
-                    first_last_ball['last_ball_home'] = ""
-                    first_last_ball['last_ball_guest'] = ""
-                    first_last_ball['not_ball'] = ""
-                first_last_ball['league_id'] = league_id
-                first_last_ball['league_name'] = league_name
-                first_last_ball['game_id'] = game_id
-                first_last_ball['team_home'] = team_home
-                first_last_ball['team_guest'] = team_guest
-                first_last_ball['number'] = number
-                first_last_ball['data_game'] = data_game
-                first_last_ball['time_game'] = time_game
-                first_last_ball['corner_ball'] = corner_ball
-                first_last_ball['score_home'] = score_home
-                first_last_ball['score_guest'] = score_guest
-                first_last_ball['half_way'] = half_way
-                first_last_ball['status'] = status
-                firstlastballlist[game_id] = first_last_ball
-                # 最先/最后进球
-                item["first_last_ball"] = firstlastballlist
-        yield item
-
-
-
-
-
-
-        # print(type(datas))
-
-
-
-        # item = Hg3535Item()
-        # ids = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[16]') # ids新列表
-        # if ids:
-        #     ids1 = set(ids)#去重
-        #     for i in ids1:
-        #         urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
-        #         print(urls)
-        #         yield Request(url=urls, callback=self.parse_each)
-        # s_k = reverli(jsonpath.jsonpath(res,'$..i-ot[0].s.k')) # s字典下面的k 数字
-        # s_n= reverli(jsonpath.jsonpath(res,'$..i-ot[0].s.n')) # s字典下面的n
-
-        # pci_ctn = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[::]..ctn'))
-        # c_ks= jsonpath.jsonpath(res,'$..i-ot[0]..egs..c..k')#递归查找c字典下面k的值返回列表
-        # c_kns = jsonpath.jsonpath(res,'$..i-ot[0]..egs..c..n')#递归查找c字典下面的n返回列表
-
-        # es_i_0s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[0]') #递归查找队1名
-        # es_i_1s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[1]')  # 递归查找队2名
-        # es_i_2s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[2]') # 递归查找num
-        # es_i_4s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[4]') # 递归查找比赛日期
-        # es_i_5s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[5]') # 比赛时间
-        # es_i_10s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[10]') #队一比分
-        # es_i_11s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[11]') # 队二比分
-        # es_i_12s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[12]') # 半场
-        # es_i_16s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[16]') #比赛id
-        # o_ah1s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ah[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o ah 列表
-        # o_ou1s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ou[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o ou 列表
-        # o_1x2s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..1x2[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1X2 列表  并不是一定存在
-        # o_ahlsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ah1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o ah1st 列表  并不是一定存在
-        # o_ou1sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ou1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o oulst 列表  并不是一定存在
-        # o_1x21sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..1x21st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_oes = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..oe[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_oelsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..oelst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_tgs = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tg[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_tglsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tglst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_hfs = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..hf[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_css = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..cs[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_cslsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..cslst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_ttslasts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ttslast[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-        # o_tts1sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tts1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
-
-        # item['league_id'] = s_k
-        # item['league_name'] = s_n
-        # item['ctn'] = pci_ctn
-        # item['one_team_name'] = es_i_0s
-        # item['two_team_name'] = es_i_1s
-        # item['num'] = es_i_2s
-        # item['date_match'] = es_i_4s
-        # item['date_time'] = es_i_5s
-        # item['one_team_score'] = es_i_10s
-        # item['two_team_score'] = es_i_11s
-        # item['half_time'] = es_i_12s
-        # item['match_id'] = es_i_16s
-        # item['give_ball'] = o_ah1s
-        # item['full_size'] = o_ou1s
-        # item['win_situation'] = o_1x2s
-        # item['half_handicap'] = o_ahlsts
-        # item['half_size'] = o_ou1sts
-        # item['half_win'] = o_1x21sts
-        # item['full_score'] = o_oes
-        # item['half_goal'] = o_oelsts
-        # item['total_goal'] = o_tgs
-        # item['first_half_goal'] = o_tglsts
-        # item['half_full_time'] = o_hfs
-        # item['full_field'] = o_css
-        # item['half_wave'] = o_cslsts
-        # item['advanced_ball'] = o_ttslasts
-        # item['final_goal'] = o_tts1sts
-        #
-        # yield item
-
-
-
-
-
-
-
-
-
-
-
-        # s_k = ("".join('%s' %id for id in s_k))#列表内数字转成字符串1
-        # pci_ctn = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[::]..ctn'))
-        # es_i1_0 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[0]'))#i1 代表es下的第一个i i2第二个
-        # es_i1_1 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[1]'))
-        # es_i1_2 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[2]'))
-        # es_i1_4 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[4]'))
-        # es_i1_5 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[5]'))
-        # es_i1_10 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[10]'))
-        # es_i1_11 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[11]'))
-        # es_i1_12 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[12]'))
-        # es_i1_16 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[16]'))
-        # es_i2_0 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[0]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_1 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[1]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_2 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[2]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_4 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[4]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_5 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[5]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_10 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[10]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_11 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[11]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_12 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[12]'))#i1 代表es下的第一个i i2第二个
-        # es_i2_16 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[16]'))#i1 代表es下的第一个i i2第二个
-        # o_ah1 = jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0]..o..ah[1,3,5,7,9,11,13,15,17,19,21]')#o字典下 ah 取奇数是个列表
-        #
-        # print(s_k)
-
-        # pass
-        # item = DoubanItem()
-        # item['movie_name'] = response.xpath('//span[@property="v:itemreviewed"]/text()').extract()
-        # item['movie_director'] = response.xpath('//a[@rel="v:directedBy"]/text()').extract()
-        # item['movie_starring'] = response.xpath('//a[@rel="v:starring"]/text()').extract()
-        # item['movie_category'] = response.xpath('//span[@property="v:genre"]/text()').extract()
-        # item['movie_time'] = response.xpath('//span[@property="v:runtime"]/text()').extract()
-        # item['movie_star'] = response.xpath('//strong[@property="v:average"]/text()').extract()
-        # item['movie_5score'] = response.xpath('//span[@class="rating_per"][1]/text()').extract()
-        # item['movie_4score'] = response.xpath('//span[@class="rating_per"][2]/text()').extract()
-        # item['movie_3score'] = response.xpath('//span[@class="rating_per"][3]/text()').extract()
-        # item['movie_2score'] = response.xpath('//span[@class="rating_per"][4]/text()').extract()
-        # item['movie_1score'] = response.xpath('//span[@class="rating_per"][5]/text()').extract()
-        # yield item
-
-    # def parse_each(self,response):
-    #     res =  json.loads(response.text)
-    #     eg_c_k = jsonpath.jsonpath(res, '$..eg.c.k')
-    #     eg_c_n = jsonpath.jsonpath(res, '$..eg.c.n')
-
-
-
-        # pass
-
-
-
-
-    # def parse_other(self, response):
-    #     print(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 = ""
-    #     if datas:
-    #         item = Temaball()
-    #         full_dict = {}
-    #         half_dict = {}
-    #         full_dict_rule = {}
-    #         half_dict_rule = {}
-    #         data_list = []
-    #         for data in datas:
-    #             try:
-    #                 new_data = data['pci']['ctid']
-    #             except:
-    #                 new_data = ""
-    #             pass
-    #             if new_data == 0:
-    #                 # 比赛id
-    #                 game_id = str(data['k'])
-    #                 data_list.append(game_id)
-    #                 # 球队1
-    #                 team_home = data['i'][0]
-    #                 data_list.append(team_home)
-    #                 # 球队2
-    #                 team_guest = data['i'][1]
-    #                 data_list.append(team_guest)
-    #                 # 数量(97>)
-    #                 number = data['i'][2]
-    #                 data_list.append(number)
-    #                 # 状态
-    #                 # zhuangtai = data['i'][3]
-    #
-    #                 # 日期
-    #                 data_game = data['i'][4]
-    #                 data_list.append(data_game)
-    #                 # 开赛时间
-    #                 time_game = data['i'][5]
-    #                 data_list.append(time_game)
-    #             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['game_id'] = data_list[0]
-    #         item['team_home'] = data_list[1]
-    #         item['team_guest'] = data_list[2]
-    #         item['number'] = data_list[3]
-    #         item['data_game'] = data_list[4]
-    #         item['time_game'] = data_list[5]
-    #         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

File diff suppressed because it is too large
+ 0 - 8
scrapy_yzd/scrapy_yzd/spiders/test.py


File diff suppressed because it is too large
+ 0 - 690
scrapy_yzd/scrapy_yzd/test1.py


+ 0 - 644
scrapy_yzd/scrapy_yzd/test3.py

@@ -1,644 +0,0 @@
-# # #!/usr/bin/env python
-# # # -*- coding: utf-8 -*-
-# # __author__ = 'ethereal'
-# # __mtime__ = '2019/3/29'
-# #
-# #
-# # # -*- 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 time
-# # from .models import st_zq_odds_record, st_zq_odds, database, st_zq_competition, st_zq_league, st_area
-# #
-# #
-# # def inset_odd(match_id,value,utime,ctime,condition,p_id,wanfa):
-# #     if st_zq_odds.filter(match_id=match_id):
-# #         for k, v in value.items():
-# #             st_zq_odd = st_zq_odds.filter(match_id=match_id, odds_code=k,p_code=wanfa)
-# #             if st_zq_odd:
-# #                 if v:
-# #                     st_zq_odds.update(utime=utime, odds=v).where(st_zq_odds.match_id == match_id,
-# #                                                                  st_zq_odds.odds_code == k).execute()
-# #             else:
-# #                 if v:
-# #                     st_zq_odds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
-# #                                       condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,odds_code=k)
-# #     else:
-# #         for k, v in value.items():
-# #             if v:
-# #                 st_zq_odds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
-# #                                   condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
-# #                                   odds_code=k)
-# #     for k, v in value.items():
-# #         if v:
-# #             st_zq_odds_record.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
-# #                                      condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
-# #                                      odds_code=k)
-# #
-# #
-# # class Chuanpipeline(object):
-# #     def process_item(self, item, spider):
-# #         if spider.name == "today_all":
-# #             # 让球大小盘
-# #             concede_sizes = item.get('concede_size', "")
-# #             if concede_sizes:
-# #                 with database.atomic():
-# #                     for key, value in concede_sizes.items():
-# #                         # 比赛日期
-# #                         data_game = value.pop('data_game').split("/")
-# #                         month = str(data_game[1].strip())
-# #                         day = str(data_game[0])
-# #                         # 比赛时间
-# #                         time_game = str(value.pop('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())
-# #                         # 比赛id
-# #                         competition_id = value.pop('game_id')
-# #                         # 联赛id
-# #                         league_id = value.pop('league_id')
-# #                         # 联赛name
-# #                         league_name = value.pop('league_name')
-# #                         # 主队
-# #                         team_home = value.pop('team_home')
-# #                         # 客队
-# #                         team_guest = value.pop('team_guest')
-# #                         # 主队得分
-# #                         score_home = value.pop('score_home')
-# #                         # 客队得分
-# #                         score_guest = value.pop('score_guest')
-# #                         # 全场让球
-# #                         # number
-# #                         number = value.pop('number')
-# #                         corner_ball = value.pop('corner_ball')
-# #                         half_way = value.pop('half_way')
-# #                         concede_home = value.get('concede_home', "")
-# #                         concede_home_rule = value.get('concede_home_rule', "")
-# #                         concede_guest = value.get("concede_guest", "")
-# #                         concede_guest_rule = value.get("concede_guest_rule", "")
-# #                         # 上半场让球
-# #                         half_concede_home = value.get("half_concede_home", "")
-# #                         half_concede_home_rule = value.get("half_concede_home_rule", "")
-# #                         half_concede_guest = value.get("half_concede_guest", "")
-# #                         half_concede_guest_rule = value.get("half_concede_guest_rule", "")
-# #                         # 全场大小
-# #                         size_home = value.get('size_home')
-# #                         size_home_rule = value.get('size_home')
-# #                         size_guest = value.get('size_guest')
-# #                         size_guest_rule = value.get('size_guest_rule', "")
-# #                         # 上半场大小
-# #                         half_size_home = value.get('half_size_home', "")
-# #                         half_size_home_rule = value.get('half_size_home_rule', "")
-# #                         half_size_guest = value.get('half_size_guset', "")
-# #                         half_size_guest_rule = value.get('half_size_guest_rule', "")
-# #                         if st_zq_odds.filter(match_id=key):
-# #                             for k, v in value.items():
-# #                                 if v:
-# #                                     for index, result in enumerate(v):
-# #                                         st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
-# #                                         if st_zq_odd:
-# #                                             if result:
-# #                                                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,st_zq_odds.sort == index,st_zq_odds.odds_code == k).execute()
-# #                                         else:
-# #                                             if result:
-# #                                                     st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-# #                         else:
-# #                             for k, v in value.items():
-# #                                 if v:
-# #                                     for index, result in enumerate(v):
-# #                                         if result:
-# #                                             st_zq_odds.create(match_id=key, ctime=utime, utime=utime, max=result,condition=index, odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
-# #                         #     # 全场让球
-# #                         #     if concede_home:
-# #                         #         for index, result in enumerate(concede_home):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="concede_home")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "concede_home").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                   condition=concede_home_rule[index], odds=result, p_id=1,
-# #                         #                                   p_code="concede_size", sort=index, odds_code="concede_home")
-# #                         #     if concede_guest:
-# #                         #         for index, result in enumerate(concede_guest):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="concede_guest")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "concede_guest").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                   condition=concede_guest_rule[index], odds=result, p_id=1,
-# #                         #                                   p_code="concede_size", sort=index, odds_code="concede_guest")
-# #                         #     if half_concede_home:
-# #                         #         for index, result in enumerate(half_concede_home):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_concede_home")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "half_concede_home").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                   condition=half_concede_home_rule[index], odds=result, p_id=1,
-# #                         #                                   p_code="concede_size", sort=index, odds_code="half_concede_home")
-# #                         #     if half_concede_guest:
-# #                         #         for index, result in enumerate(half_concede_guest):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_concede_home")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "half_concede_guest").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime,
-# #                         #                                   max=half_concede_guest[index],
-# #                         #                                   condition=half_concede_guest_rule[index],
-# #                         #                                   odds=half_concede_guest[index], p_id=1, p_code="concede_size",
-# #                         #                                   sort=index, odds_code="half_concede_guest")
-# #                         #     if size_home:
-# #                         #         for index, result in enumerate(size_home):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="size_home")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "size_home").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                   condition=size_home_rule[index], odds=result, p_id=1,
-# #                         #                                   p_code="concede_size", sort=index, odds_code="size_home")
-# #                         #     if size_guest:
-# #                         #         for index, result in enumerate(size_home):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="size_guest")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "size_guest").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                   condition=size_guest_rule[index], odds=result, p_id=1,
-# #                         #                                   p_code="concede_size", sort=index, odds_code="size_guest")
-# #                         #     if half_size_home:
-# #                         #         for index, result in enumerate(half_size_home):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_size_home")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "half_size_home").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                   condition=half_size_home_rule[index], odds=result, p_id=1,
-# #                         #                                   p_code="concede_size", sort=index, odds_code="half_size_home")
-# #                         #     if half_size_guest:
-# #                         #         for index, result in enumerate(half_size_guest):
-# #                         #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_size_guest")
-# #                         #             if st_zq_odd:
-# #                         #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
-# #                         #                                                                   st_zq_odds.sort == index,
-# #                         #                                                                   st_zq_odds.odds_code == "half_size_guest").execute()
-# #                         #             else:
-# #                         #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                   condition=half_size_guest_rule[index], odds=result, p_id=1,
-# #                         #                                   p_code="concede_size", sort=index, odds_code="half_size_guest")
-# #                         # else:
-# #                         #     if concede_home:
-# #                         #         for index, result in enumerate(concede_home):
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                               condition=concede_home_rule[index], odds=result, p_id=1,
-# #                         #                               p_code="concede_size", sort=index, odds_code="concede_home")
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=concede_guest[index],
-# #                         #                               condition=concede_guest_rule[index], odds=concede_guest[index],
-# #                         #                               p_id=1, p_code="concede_size", sort=index, odds_code="concede_guest")
-# #                         #     if half_concede_home:
-# #                         #         for index, result in enumerate(half_concede_home):
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                               condition=half_concede_home_rule[index], odds=result, p_id=1,
-# #                         #                               p_code="concede_size", sort=index, odds_code="half_concede_home")
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=half_concede_guest[index],
-# #                         #                               condition=half_concede_guest_rule[index],
-# #                         #                               odds=half_concede_guest[index], p_id=1, p_code="concede_size",
-# #                         #                               sort=index, odds_code="half_concede_guest")
-# #                         #     if size_home:
-# #                         #         for index, result in enumerate(size_home):
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                               condition=size_home_rule[index], odds=result, p_id=1,
-# #                         #                               p_code="concede_size", sort=index, odds_code="size_home")
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=size_guest[index],
-# #                         #                               condition=size_guest_rule[index], odds=size_guest[index], p_id=1,
-# #                         #                               p_code="concede_size", sort=index, odds_code="size_guest")
-# #                         #     if half_size_home:
-# #                         #         for index, result in enumerate(half_size_home):
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                               condition=half_size_home_rule[index], odds=result, p_id=1,
-# #                         #                               p_code="concede_size", sort=index, odds_code="half_size_home")
-# #                         #     if half_size_guest:
-# #                         #         for index, result in enumerate(half_size_guest):
-# #                         #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=half_size_guest[index],
-# #                         #                               condition=half_size_guest_rule[index], odds=half_size_guest[index],
-# #                         #                               p_id=1, p_code="concede_size", sort=index,
-# #                         #                               odds_code="half_size_guest")
-# #                         # if concede_home:
-# #                         #     for index, result in enumerate(concede_home):
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                  condition=concede_home_rule[index], odds=result, p_id=1,
-# #                         #                                  p_code="concede_size", sort=index, odds_code="concede_home")
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=concede_guest[index],
-# #                         #                                  condition=concede_guest_rule[index], odds=concede_guest[index],
-# #                         #                                  p_id=1, p_code="concede_size", sort=index,
-# #                         #                                  odds_code="concede_guest")
-# #                         # if half_concede_home:
-# #                         #     for index, result in enumerate(half_concede_home):
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                  condition=half_concede_home_rule[index], odds=result, p_id=1,
-# #                         #                                  p_code="concede_size", sort=index, odds_code="half_concede_home")
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime,
-# #                         #                                  max=half_concede_guest[index],
-# #                         #                                  condition=half_concede_guest_rule[index],
-# #                         #                                  odds=half_concede_guest[index], p_id=1, p_code="concede_size",
-# #                         #                                  sort=index, odds_code="half_concede_guest")
-# #                         # if size_home:
-# #                         #     for index, result in enumerate(size_home):
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                  condition=size_home_rule[index], odds=result, p_id=1,
-# #                         #                                  p_code="concede_size", sort=index, odds_code="size_home")
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=size_guest[index],
-# #                         #                                  condition=size_guest_rule[index], odds=size_guest[index], p_id=1,
-# #                         #                                  p_code="concede_size", sort=index, odds_code="size_guest")
-# #                         # if half_size_home:
-# #                         #     for index, result in enumerate(half_size_home):
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
-# #                         #                                  condition=half_size_home_rule[index], odds=result, p_id=1,
-# #                         #                                  p_code="concede_size", sort=index, odds_code="half_size_home")
-# #                         # if half_size_guest:
-# #                         #     for index, result in enumerate(half_size_guest):
-# #                         #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=half_size_guest[index],
-# #                         #                                  condition=half_size_guest_rule[index], odds=half_size_guest[index],
-# #                         #                                  p_id=1, p_code="concede_size", sort=index,
-# #                         #                                  odds_code="half_size_guest")
-# #                         # if st_zq_competition.filter(match_id=key):
-# #                         #     pass
-# #                         # else:
-# #                         #     st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
-# #
-# #             # 独赢
-# #             capots = item.get('capot', "")
-# #             if capots:
-# #                 with database.atomic():
-# #                     for key, value in capots.items():
-# #                         # 比赛日期
-# #                         data_game = value.pop('data_game').split("/")
-# #                         month = str(data_game[1].strip())
-# #                         day = str(data_game[0])
-# #                         # 比赛时间
-# #                         time_game = str(value.pop('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())
-# #                         # 比赛id
-# #                         competition_id = value.pop('game_id')
-# #                         # 联赛id
-# #                         league_id = value.pop('league_id')
-# #                         # 联赛name
-# #                         league_name = value.pop('league_name')
-# #                         # 主队
-# #                         team_home = value.pop('team_home')
-# #                         # 客队
-# #                         team_guest = value.pop('team_guest')
-# #                         # 主队得分
-# #                         score_home = value.pop('score_home')
-# #                         # 客队得分
-# #                         score_guest = value.pop('score_guest')
-# #                         # number
-# #                         number = value.pop('number')
-# #                         corner_ball = value.pop('corner_ball')
-# #                         half_way = value.pop('half_way')
-# #                         capot_dict = {"capot_home":"1","capot_guest": "2","capot_dogfall":"x","half_capot_home":"1","half_capot_guest": "2","half_capot_dogfall":"x"}
-# #                         if corner_ball:
-# #                             wanfa = corner_ball
-# #                             p_id = 9
-# #                         else:
-# #                             wanfa = "capot"
-# #                             p_id = 2
-# #                         inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=capot_dict, p_id=p_id, wanfa=wanfa)
-# #                         if st_zq_competition.filter(match_id=key):
-# #                             pass
-# #                         else:
-# #                             st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
-# #
-# #
-# #             # 入球数-单双
-# #             odd_evens = item.get("odd_even", "")
-# #             if odd_evens:
-# #                 with database.atomic():
-# #                     for key, value in odd_evens.items():
-# #                         data_game = value.pop('data_game').split("/")
-# #                         month = str(data_game[1].strip())
-# #                         day = str(data_game[0])
-# #                         time_game = str(value.pop('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())
-# #                         competition_id = value.pop('game_id')
-# #                         league_id = value.pop('league_id')
-# #                         league_name = value.pop('league_name')
-# #                         team_home = value.pop('team_home')
-# #                         team_guest = value.pop('team_guest')
-# #                         score_home = value.pop('score_home')
-# #                         score_guest = value.pop('score_guest')
-# #                         number = value.pop('number')
-# #                         corner_ball = value.pop('corner_ball')
-# #                         half_way = value.pop('half_way')
-# #                         odd_even_dict = {"odd_even_odd":"单","odd_even_even": "双","half_odd_even_odd": "单","half_odd_even_even":"双"}
-# #                         inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=odd_even_dict, p_id=3, wanfa="odd_even")
-# #                         if st_zq_competition.filter(match_id=key):
-# #                             pass
-# #                         else:
-# #                             st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
-# #
-# #             # 总入球
-# #             total_goals = item.get('total_goal', "")
-# #             if total_goals:
-# #                 with database.atomic():
-# #                     for key, value in total_goals.items():
-# #                         data_game = value.pop('data_game').split("/")
-# #                         month = str(data_game[1].strip())
-# #                         day = str(data_game[0])
-# #                         time_game = str(value.pop('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())
-# #                         competition_id = value.pop('game_id')
-# #                         league_id = value.pop('league_id')
-# #                         league_name = value.pop('league_name')
-# #                         team_home = value.pop('team_home')
-# #                         team_guest = value.pop('team_guest')
-# #                         score_home = value.pop('score_home')
-# #                         score_guest = value.pop('score_guest')
-# #                         number = value.pop('number')
-# #                         corner_ball = value.pop('corner_ball')
-# #                         half_way = value.pop('half_way')
-# #                         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或以上'}
-# #                         inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=total_dict, p_id=4, wanfa="total_goal")
-# #                         if st_zq_competition.filter(match_id=key):
-# #                             pass
-# #                         else:
-# #                             st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
-# #
-# #             # 半场/全场
-# #             half_fulls = item.get("half_full", "")
-# #             if half_fulls:
-# #                 with database.atomic():
-# #                     for key, value in half_fulls.items():
-# #                         data_game = value.pop('data_game').split("/")
-# #                         month = str(data_game[1].strip())
-# #                         day = str(data_game[0])
-# #                         time_game = str(value.pop('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())
-# #                         competition_id = value.pop('game_id')
-# #                         league_id = value.pop('league_id')
-# #                         league_name = value.pop('league_name')
-# #                         team_home = value.pop('team_home')
-# #                         team_guest = value.pop('team_guest')
-# #                         score_home = value.pop('score_home')
-# #                         score_guest = value.pop('score_guest')
-# #                         number = value.pop('number')
-# #                         corner_ball = value.pop('corner_ball')
-# #                         half_way = value.pop('half_way')
-# #                         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": "客客"}
-# #                         inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=full_dict, p_id=5,wanfa="half_full")
-# #                         if st_zq_competition.filter(match_id=key):
-# #                             pass
-# #                         else:
-# #                             st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
-# #
-# #
-# #             # 波胆
-# #             bodans = item.get("bodan", "")
-# #             if bodans:
-# #                 with database.atomic():
-# #                     for key, value in bodans.items():
-# #                         data_game = value.pop('data_game').split("/")
-# #                         month = str(data_game[1].strip())
-# #                         day = str(data_game[0])
-# #                         time_game = str(value.pop('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())
-# #                         competition_id = value.pop('game_id')
-# #                         league_id = value.pop('league_id')
-# #                         league_name = value.pop('league_name')
-# #                         team_home = value.pop('team_home')
-# #                         team_guest = value.pop('team_guest')
-# #                         score_home = value.pop('score_home')
-# #                         score_guest = value.pop('score_guest')
-# #                         number = value.pop('number')
-# #                         corner_ball = value.pop('corner_ball')
-# #                         half_way = value.pop('half_way')
-# #                         new_bodan = value['bodan']
-# #                         bodan_dict = {"bodan_home_one_zero": "1-0", "bodan_home_two_zero": "2-0",
-# #                                       "bodan_home_two_one": "2-1", "bodan_home_three_zero": "3-0",
-# #                                       "bodan_home_three_one": "3-1", "bodan_home_three_two": "3-2",
-# #                                       "bodan_home_four_zero": "4-0", "bodan_home_four_one": "4-1",
-# #                                       "bodan_home_four_two": "4-2", "bodan_home_four_three": "4-3",
-# #                                       "bodan_guest_one_zero": "1-0", "bodan_guest_two_zero": "2-0",
-# #                                       "bodan_guest_two_one": "2-0", "bodan_guest_three_zero": "3-0",
-# #                                       "bodan_guest_three_one": "3-1", "bodan_guest_three_two": "3-2",
-# #                                       "bodan_guest_four_zero": "4-0", "bodan_guest_four_one": "4-1",
-# #                                       "bodan_guest_four_two": "4-2", "bodan_guest_four_three": "4-3",
-# #                                       "bodan_dogfall_zero_zero": "0-0", "bodan_dogfall_one_one": "1-1",
-# #                                       "bodan_dogfall_two_two": "2-2", "bodan_dogfall_three_three": "3-3",
-# #                                       "bodan_dogfall_four_four": "4-4", "bodan_other": "其他"}
-# #                         # 插入全场波胆
-# #                         if new_bodan:
-# #                             inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=bodan_dict, p_id=6,
-# #                                       wanfa="bodan")
-# #
-# #                         half_bodan = value['half_bodan']
-# #                         half_bodan_dict = {"bodan_home_one_zero": "1-0", "bodan_home_two_zero": "2-0",
-# #                                            "bodan_home_two_one": "2-1", "bodan_home_three_zero": "3-0",
-# #                                            "bodan_home_three_one": "3-1", "bodan_home_three_two": "3-2",
-# #                                            "bodan_guest_one_zero": "1-0", "bodan_guest_two_zero": "2-0",
-# #                                            "bodan_guest_two_one": "2-0", "bodan_guest_three_zero": "3-0",
-# #                                            "bodan_guest_three_one": "3-1", "bodan_guest_three_two": "3-2",
-# #                                            "bodan_dogfall_zero_zero": "0-0", "bodan_dogfall_one_one": "1-1",
-# #                                            "bodan_dogfall_two_two": "2-2", "bodan_dogfall_three_three": "3-3",
-# #                                            "bodan_other": "其他"}
-# #                         if half_bodan:
-# #                             if st_zq_odds.filter(match_id=key):
-# #                                 for k, v in half_bodan.items():
-# #                                     st_zq_odd = st_zq_odds.filter(match_id=key, odds_code="half_"+k,p_code="bodan")
-# #                                     if st_zq_odd:
-# #                                         if v:
-# #                                             st_zq_odds.update(utime=utime, odds=v).where(st_zq_odds.match_id == key,
-# #                                                                                          st_zq_odds.odds_code == k).execute()
-# #                                     else:
-# #                                         st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=v,
-# #                                                           condition=half_bodan_dict[k], odds=v, p_id=6, p_code="bodan",
-# #                                                           odds_code="half_"+k)
-# #                             else:
-# #                                 for k, v in half_bodan.items():
-# #                                     if v:
-# #                                         st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=v,
-# #                                                           condition=half_bodan_dict[k], odds=v, p_id=6, p_code="bodan",
-# #                                                           odds_code="half_"+k)
-# #                             for k, v in half_bodan.items():
-# #                                 if v:
-# #                                     st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=v,
-# #                                                              condition=half_bodan_dict[k], odds=v, p_id=6, p_code="bodan",odds_code="half_"+k)
-# #                         if st_zq_competition.filter(match_id=key):
-# #                             pass
-# #                         else:
-# #                             st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
-# #
-# #             #最先/最后进球
-# #             first_last_balls = item.get("first_last_ball","")
-# #             if first_last_balls:
-# #                 with database.atomic():
-# #                     for key, value in first_last_balls.items():
-# #                         data_game = value.pop('data_game').split("/")
-# #                         month = str(data_game[1].strip())
-# #                         day = str(data_game[0])
-# #                         time_game = str(value.pop('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())
-# #                         competition_id = value.pop('game_id')
-# #                         league_id = value.pop('league_id')
-# #                         league_name = value.pop('league_name')
-# #                         team_home = value.pop('team_home')
-# #                         team_guest = value.pop('team_guest')
-# #                         score_home = value.pop('score_home')
-# #                         score_guest = value.pop('score_guest')
-# #                         number = value.pop('number')
-# #                         corner_ball = value.pop('corner_ball')
-# #                         half_way = value.pop('half_way')
-# #                         first_last_dict = {"first_last_ball":"最先进球","first_ball_home":"最后进球","first_ball_guest":"最先进球","last_ball_home":"最后进球","last_ball_guest": "最后进球","not_ball":"没有进球"}
-# #                         inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=first_last_dict, p_id=7,wanfa="first_last_ball")
-# #
-# #                         if st_zq_competition.filter(match_id=key):
-# #                             pass
-# #                         else:
-# #                             st_zq_competition.create(home_team=team_home, guest_team=team_guest, lg_id=league_id,
-# #                                                      match_id=competition_id, match_date=r_ctime, match_time=time_game, ctime=utime,
-# #                                                      utime=utime, tag=number)
-# #
-# #             # 冠军
-# #             champions = item.get("champion","")
-# #             if champions:
-# #                 with database.atomic():
-# #                     for key, value in champions.items():
-# #                         data_game = value['data_game'].replace('年',"-").replace('月',"-").replace('日',"")
-# #                         time_game = value['time_game']
-# #                         ctime = data_game + " " + time_game
-# #                         utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-# #                         league_name =value['league_name']
-# #                         tema_home = value['tema_home']
-# #                         league_id = value['league_id']
-# #                         game_id = value['game_id']
-# #                         new_league_name = value['new_league_name']
-# #                         champion_team = value['champion_team']
-# #                         new_champion = value['new_champion']
-# #                         if st_zq_odds.filter(match_id=key):
-# #                             st_zq_odd = st_zq_odds.filter(match_id=key, odds_code=tema_home)
-# #                             if st_zq_odd:
-# #                                 if new_champion:
-# #                                     st_zq_odds.update(utime=utime, odds=champion_team).where(st_zq_odds.match_id == key,
-# #                                                                                  st_zq_odds.odds_code == k).execute()
-# #                             else:
-# #                                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=champion_team,
-# #                                                   condition=new_champion, odds=champion_team, p_id=8, p_code="champion",odds_code=tema_home)
-# #                         else:
-# #                             if new_champion:
-# #                                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=champion_team,condition=new_champion, odds=champion_team, p_id=8, p_code="champion",odds_code=tema_home)
-# #                         if new_champion:
-# #                             st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=champion_team,condition=new_champion, odds=champion_team, p_id=8, p_code="champion",odds_code=tema_home)
-# #
-# #
-# # class Lianpipeline(object):
-# #     def process_item(self, item, spider):
-# #         # print(item)
-# #         # if spider.name == "liansai":
-# #             area_id = item["area_id"]
-# #             area_name = item["area_name"]
-# #             st_league = item["st_zq_league"]
-# #             name_chinese = item["name_chinese"]
-# #             st_zq_leagues = st_zq_league.filter(id=st_league)
-# #             utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-# #             if st_zq_leagues:
-# #                 pass
-# #             else:
-# #                 st_zq_league.create(name_chinese=name_chinese,id=st_league,country_id=area_id,if_stop=0,league_list=0,bf_Ifdisplay=0,if_have_sub=0,curr_round=0)
-# #             area_ids = st_area.filter(id=area_id)
-# #             if area_ids:
-# #                 pass
-# #             else:
-# #                 st_area.create(id=area_id, title=area_name, create_time=utime)
-# #
-# import random
-# import time
-# 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
-#
-#
-# snow = MySnow(dataID="097571")
-# print(snow.get_id())
-# a = len(snow.get_id())
-# print(a)
-#
-#
-# def shuffle_list(some_list):
-#     randomized_list = some_list[:]
-#     while True:
-#         random.shuffle(randomized_list)
-#         for a, b in zip(some_list, randomized_list):
-#             if a == b:
-#                 break
-#         else:
-#             return randomized_list
-#

File diff suppressed because it is too large
+ 0 - 0
scrapy_yzd/test.json


File diff suppressed because it is too large
+ 0 - 13
scrapy_yzd/test4.py


Some files were not shown because too many files changed in this diff