fix some bugs
This commit is contained in:
parent
48ea3536cf
commit
2a5c032013
@ -2,6 +2,8 @@ from DoubanSpider import *
|
|||||||
from DoubanSpider.db import Douban, engine, Recording
|
from DoubanSpider.db import Douban, engine, Recording
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
|
logger = logging.getLogger("PAPA")
|
||||||
|
|
||||||
|
|
||||||
class DoubanBook(object):
|
class DoubanBook(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -108,7 +110,8 @@ class DoubanBook(object):
|
|||||||
print(f'正在保存:{name}。')
|
print(f'正在保存:{name}。')
|
||||||
self.save_csv(data)
|
self.save_csv(data)
|
||||||
|
|
||||||
def save_csv(self, data):
|
@staticmethod
|
||||||
|
def save_csv(data):
|
||||||
with open('results.csv', 'a', encoding='utf-8') as f:
|
with open('results.csv', 'a', encoding='utf-8') as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
writer.writerow(data)
|
writer.writerow(data)
|
||||||
|
1
main.py
1
main.py
@ -28,7 +28,6 @@ def url_pool():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger("PAPA")
|
|
||||||
sleeptime = random.randint(0, 3)
|
sleeptime = random.randint(0, 3)
|
||||||
with open("results.csv", "a", encoding='utf-8') as f:
|
with open("results.csv", "a", encoding='utf-8') as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
|
Loading…
Reference in New Issue
Block a user