test_backlink.py 714 B

123456789101112131415161718
  1. # Get the first 20 hits for: "Breaking Code" WordPress blog
  2. from googlesearch import search
  3. import dataset
  4. import time
  5. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
  6. table=db['backlinks']
  7. #for url in search('link:https://www.searchome.net/ -site:searchome.net', num_results=100):
  8. #for url in search('link:https://www.searchome.net/ -site:searchome.net', 10):
  9. #for url in search('link:https://www.searchome.net/ -site:searchome.net 2020..2021',start=70,stop=1000):
  10. for url in search('link:https://www.searchome.net/ -site:searchome.net 2020..2021',stop=1000):
  11. try:
  12. table.insert({'url':url})
  13. time.sleep(4)
  14. except:
  15. print('except')
  16. print(url)