File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 15
15
cursor .execute ('CREATE TABLE IF NOT EXISTS crawl_index ( url VARCHAR(256) PRIMARY KEY, title VARCHAR(256), keywords VARCHAR(256) )' )
16
16
cursor .execute ('CREATE TABLE IF NOT EXISTS queue ( url VARCHAR(256) PRIMARY KEY )' )
17
17
connection .commit ()
18
+
19
+ if len (argv ) < 2 :
20
+ print "No starting point! Checking existing queue"
21
+ cursor .execute ("SELECT * FROM queue LIMIT 1" )
22
+ c = cursor .fetchone ()
23
+ if c == None :
24
+ sys .exit ("ERROR: No start point! Exiting" )
18
25
try :
19
- cursor .execute ("INSERT INTO queue VALUES ( (?) )" , (sys .argv [1 ], ))
20
- connection .commit ()
26
+ if sys .argv [1 ]:
27
+ cursor .execute ("INSERT INTO queue VALUES ( (?) )" , (sys .argv [1 ], ))
28
+ connection .commit ()
21
29
except :
22
30
pass
23
31
keywordregex = re .compile ('<meta\sname=["\' ]keywords["\' ]\scontent=["\' ](.*?)["\' ]\s/>' )
You can’t perform that action at this time.
0 commit comments