# Get the first 20 hits for: "Breaking Code" WordPress blog
from googlesearch import search
import dataset
import time

db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
table=db['backlinks']
#for url in search('link:https://www.searchome.net/ -site:searchome.net', num_results=100):
#for url in search('link:https://www.searchome.net/ -site:searchome.net', 10):
for url in search('link:https://www.searchome.net/ -site:searchome.net',start=60,stop=1000):
    try:
        table.insert({'url':url})
        time.sleep(5)
    except:
        print('except')
    print(url)
