gs-dump-urls: add support for old wpull 1.x wpull.db files

This commit is contained in:
Ivan Kozik 2018-10-08 10:55:03 +00:00
parent cbf202fb44
commit 20dfd9966b

View File

@ -29,10 +29,19 @@ def main(wpull_db_file, status):
conn = sqlite3.connect(wpull_db_file)
c = conn.cursor()
rows = c.execute(
"SELECT url_strings.url FROM queued_urls "
"JOIN url_strings ON queued_urls.url_string_id=url_strings.id "
"WHERE status=?;", (status,))
try:
# query for wpull 2.0+ wpull.db
rows = c.execute(
"SELECT url_strings.url FROM queued_urls "
"JOIN url_strings ON queued_urls.url_string_id=url_strings.id "
"WHERE status=?;", (status,))
except sqlite3.OperationalError:
# query for wpull 1.x wpull.db
rows = c.execute(
"SELECT url_strings.url FROM urls "
"JOIN url_strings ON urls.url_str_id=url_strings.id "
"WHERE status=?;", (status,))
for row in rows:
print(row[0])