executable_shop 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. import argparse
  3. import subprocess
  4. def main():
  5. parser = argparse.ArgumentParser(description="Open URLs in online shops")
  6. parser.add_argument("-c", "--context", default="generic", required=False, help="Product context")
  7. parser.add_argument("products", metavar="P", type=str, nargs="+", help="Product name")
  8. args = parser.parse_args()
  9. query = args.products[0]
  10. urls = {
  11. "generic": [
  12. "https://www.e-katalog.ru/ek-list.php?search_=" + query,
  13. "https://www.ozon.ru/search/?from_global=true&text=" + query,
  14. "https://www.wildberries.ru/catalog/0/search.aspx?search=" + query,
  15. "https://www.avito.ru/sankt-peterburg?localPriority=0&q=" + query,
  16. "https://www.amazon.com/s?url=search-alias%3Daps&field-keywords=" + query,
  17. "https://www.ebay.com/sch/i.html?_nkw=" + query + "&_sacat=0",
  18. "https://aliexpress.ru/wholesale?catId=0&initiative_id=SB_20210109221453&SearchText=" + query,
  19. ],
  20. "food": [
  21. "https://www.okeydostavka.ru/webapp/wcs/stores/servlet/SearchDisplay?categoryId=&storeId=10653&catalogId=12052&langId=-20&sType=SimpleSearch&resultCatEntryType=2&showResultsPage=true&searchSource=Q&pageView=&beginIndex=0&pageSize=72&searchTerm=" + query,
  22. "https://vprok.ru/catalog/search?text=" + query
  23. ]
  24. }
  25. for url in urls[args.context]:
  26. subprocess.run(["firefox", url])
  27. if __name__ == "__main__":
  28. # execute only if run as a script
  29. main()