Bläddra i källkod

Merge branch 'dev' of http://git.ycjcjy.com/niucai/crawl into dev

张延森 4 år sedan
förälder
incheckning
369db317fa

Binär
crawl/__pycache__/__init__.cpython-38.pyc Visa fil


Binär
crawl/__pycache__/settings.cpython-38.pyc Visa fil


Binär
crawl/comm/__pycache__/__init__.cpython-38.pyc Visa fil


Binär
crawl/comm/__pycache__/basketball.cpython-38.pyc Visa fil


Binär
crawl/comm/__pycache__/football.cpython-38.pyc Visa fil


Binär
crawl/comm/__pycache__/lottery.cpython-38.pyc Visa fil


Binär
crawl/comm/__pycache__/mydb.cpython-38.pyc Visa fil


+ 1
- 1
crawl/run.py Visa fil

@@ -7,4 +7,4 @@ print(dirpath)
7 7
 # 添加环境变量
8 8
 sys.path.append(dirpath)
9 9
 # 启动爬虫,第三个参数为爬虫name
10
-execute(['scrapy','crawl','lottery'])
10
+execute(['scrapy','crawl','football-result'])

Binär
crawl/spiders/__pycache__/__init__.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/basketball_match.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/basketball_price.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/basketball_result.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/football.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/football_match.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/football_price.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/football_result.cpython-38.pyc Visa fil


Binär
crawl/spiders/__pycache__/lottery.cpython-38.pyc Visa fil


+ 2
- 2
crawl/spiders/basketball_match.py Visa fil

@@ -26,8 +26,8 @@ class BasketballSpider(scrapy.Spider):
26 26
       matchWeek = prop[0].css('::text').get()
27 27
       league = prop[1].css('::text').get()
28 28
       team = prop[2].css('::text').get().split('VS')
29
-      homeTeam = team[0].strip()
30
-      awayTeam = team[1].strip()
29
+      homeTeam = team[1].strip()
30
+      awayTeam = team[0].strip()
31 31
       matchTime = prop[3].css('::text').get()
32 32
       status = prop[5].css('::text').get()
33 33
       wl = self.parsePassWay(prop[6].css('img'))

+ 9
- 3
crawl/spiders/football_result.py Visa fil

@@ -1,5 +1,6 @@
1 1
 import scrapy
2 2
 import re
3
+import logging
3 4
 from crawl.comm.football import FTResult
4 5
 
5 6
 class FootballSpider(scrapy.Spider):
@@ -28,9 +29,9 @@ class FootballSpider(scrapy.Spider):
28 29
       awayTeam = self.trimBrackets(tdNodeList[3].css('.ke::text').get()) # 客队
29 30
       half = tdNodeList[4].css('span::text').get()
30 31
       whole = tdNodeList[5].css('span::text').get()
31
-      status = tdNodeList[9].css('span::text').get()
32
+      status = tdNodeList[9].css('::text').get()
32 33
 
33
-      FTResult(
34
+      ftResult = FTResult(
34 35
         matchTime,
35 36
         matchWeek,
36 37
         leagueName,
@@ -40,7 +41,12 @@ class FootballSpider(scrapy.Spider):
40 41
         half,
41 42
         whole,
42 43
         status
43
-      ).persist()
44
+      )
45
+      
46
+      logging.info("采集到数据 --> %s" % ftResult.toString())
47
+
48
+      ftResult.persist()
49
+
44 50
 
45 51
     # 是否存在下一页
46 52
     pgNodes = response.css('.m-page .u-pg2')