Skip to content

Commit

Permalink
get data image
Browse files Browse the repository at this point in the history
  • Loading branch information
yatan committed Nov 19, 2017
1 parent cfb91a7 commit 14cf25d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions get_data_from_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ def get_API(photo_url):
cursor.execute('SELECT * FROM links')
for row in cursor:
# row['name'] returns the name column in the query, row['email'] returns email column.
print "Geting info id: " + str(row[0]) + " url: " + row[2]

#print('Getting info link id {0} = {1}'.format(row["id"], row["link"]))
# Get API info to DB
# for concept in concepts:
# print(concept['name'], concept['value'])
concepts = get_API(row[2])
for concept in concepts:
print(concept['name'], concept['value'])

photo_id = str(row[0])
if not check_existed_link_id(photo_id):
print "Geting info id: " + photo_id + " url: " + row[2]

#print('Getting info link id {0} = {1}'.format(row["id"], row["link"]))
# Get API info to DB
# for concept in concepts:
# print(concept['name'], concept['value'])
concepts = get_API(row[2])
cursor2 = db.cursor()
for concept in concepts:
cursor2.execute('INSERT INTO data(link_id, type, posible) VALUES(?,?,?)', ((str(row[0]), concept['name'], str(concept['value'])) ))
print "Adding id: " + str(row[0]) + " " + concept['name'] + ":" + str(concept['value']) + " to DB."
# Write Changes
db.commit()
else:
print photo_id + " ja existeix."

db.close()

Expand Down
Binary file modified web/data/crawler
Binary file not shown.

0 comments on commit 14cf25d

Please sign in to comment.