11# -*- coding: utf-8 -*-
22
3- import sys , webbrowser
3+ import sys
4+ import webbrowser
45try :
56 import urllib .parse as urlparse
67except ImportError :
@@ -13,72 +14,91 @@ def open_browsers(event):
1314 product = productNameEntry .get ()
1415 searchedArray = []
1516
16-
1717 if surugayaCheck .get () == True :
18- surugayaURL = "https://www.suruga-ya.jp/search?category=&search_word=" + urlparse .quote (product .encode ('utf-8' ))
18+ surugayaURL = "https://www.suruga-ya.jp/search?category=&search_word=" + \
19+ urlparse .quote (product .encode ('utf-8' ))
20+ if newestSort .get () == True :
21+ surugayaURL = surugayaURL + "&rankBy=modificationTime%3Adescending"
1922 searchedArray .append (surugayaURL )
2023
2124 if mandarakeCheck .get () == True :
22- mandarakeURL = "https://order.mandarake.co.jp/order/listPage/list?keyword=" + urlparse .quote (product .encode ('utf-8' ))
25+ mandarakeURL = "https://order.mandarake.co.jp/order/listPage/list?keyword=" + \
26+ urlparse .quote (product .encode ('utf-8' ))
27+ if newestSort .get () == True :
28+ mandarakeURL = mandarakeURL + "&sort=arrival&sortOrder=1"
2329 searchedArray .append (mandarakeURL )
2430
2531 if mercariCheck .get () == True :
26- mercariURL = "https://www.mercari.com/jp/search/?keyword=" + urlparse .quote (product .encode ('utf-8' ))
32+ mercariURL = "https://www.mercari.com/jp/search/?keyword=" + \
33+ urlparse .quote (product .encode ('utf-8' ))
34+ if newestSort .get () == True :
35+ mercariURL = mercariURL + "&sort_order=created_desc"
2736 searchedArray .append (mercariURL )
2837
2938 if yahooCheck .get () == True :
30- yahooURL = "https://auctions.yahoo.co.jp/search/search?auccat=&tab_ex=commerce&ei=utf-8&aq=-1&oq=&sc_i=&exflg=1&p=" + urlparse .quote (product .encode ('utf-8' )) + "&x=0&y=0"
39+ yahooURL = "https://auctions.yahoo.co.jp/search/search?auccat=&tab_ex=commerce&ei=utf-8&aq=-1&oq=&sc_i=&exflg=1&p=" + \
40+ urlparse .quote (product .encode ('utf-8' )) + "&x=0&y=0"
41+ if newestSort .get () == True :
42+ yahooURL = yahooURL + "&new=1"
3143 searchedArray .append (yahooURL )
3244
3345 if otamartCheck .get () == True :
34- otamartURL = "https://otamart.com/search/?keyword=" + urlparse .quote (product .encode ('utf-8' ))
46+ otamartURL = "https://otamart.com/search/?keyword=" + \
47+ urlparse .quote (product .encode ('utf-8' )) # otamart not support newest sort :-(
3548 searchedArray .append (otamartURL )
3649
3750 for searchPage in searchedArray :
3851 webbrowser .open_new (searchPage )
3952
53+
4054window = tk .Tk ()
4155window .title ('Second Hand' )
4256# window.geometry('500x500')
4357
4458productLabel = tk .Label (window , text = '商品名' )
45- productLabel .grid (row = 0 , column = 0 , sticky = 'w' )
59+ productLabel .grid (row = 0 , column = 0 , sticky = 'w' )
4660
4761productNameEntry = tk .Entry (window )
48- productNameEntry .grid (row = 0 , column = 1 )
62+ productNameEntry .grid (row = 0 , column = 1 )
4963
5064searchButton = tk .Button (window , text = 'Search' )
5165searchButton .bind ('<Button-1>' , open_browsers )
52- searchButton .grid (row = 0 , column = 2 )
66+ searchButton .grid (row = 0 , column = 2 )
5367
5468surugayaCheck = tk .BooleanVar ()
55- surugayaCheckButton = tk .Checkbutton (window , text = "Suruga-ya" , variable = surugayaCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
69+ surugayaCheckButton = tk .Checkbutton (
70+ window , text = "Suruga-ya" , variable = surugayaCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
5671surugayaCheckButton .select ()
57- surugayaCheckButton .grid (row = 1 , column = 0 , sticky = 'w' )
72+ surugayaCheckButton .grid (row = 1 , column = 0 , sticky = 'w' )
5873
5974mandarakeCheck = tk .BooleanVar ()
60- mandarakeCheckButton = tk .Checkbutton (window , text = "Mandarake" , variable = mandarakeCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
75+ mandarakeCheckButton = tk .Checkbutton (
76+ window , text = "Mandarake" , variable = mandarakeCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
6177mandarakeCheckButton .select ()
62- mandarakeCheckButton .grid (row = 1 , column = 1 )
78+ mandarakeCheckButton .grid (row = 1 , column = 1 )
6379
6480mercariCheck = tk .BooleanVar ()
65- mercariCheckButton = tk .Checkbutton (window , text = "Mercari" , variable = mercariCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
81+ mercariCheckButton = tk .Checkbutton (
82+ window , text = "Mercari" , variable = mercariCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
6683mercariCheckButton .select ()
67- mercariCheckButton .grid (row = 2 , column = 0 , sticky = 'w' )
84+ mercariCheckButton .grid (row = 2 , column = 0 , sticky = 'w' )
6885
6986yahooCheck = tk .BooleanVar ()
70- yahooCheckButton = tk .Checkbutton (window , text = "Yahoo Auction" , variable = yahooCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
87+ yahooCheckButton = tk .Checkbutton (
88+ window , text = "Yahoo Auction" , variable = yahooCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
7189yahooCheckButton .select ()
72- yahooCheckButton .grid (row = 2 , column = 1 )
90+ yahooCheckButton .grid (row = 2 , column = 1 )
7391
7492otamartCheck = tk .BooleanVar ()
75- otamartCheckButton = tk .Checkbutton (window , text = "Otamart" , variable = otamartCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
93+ otamartCheckButton = tk .Checkbutton (
94+ window , text = "Otamart" , variable = otamartCheck , onvalue = True , offvalue = False , height = 0 , width = 0 )
7695otamartCheckButton .select ()
77- otamartCheckButton .grid (row = 3 , column = 0 , sticky = 'w' )
78-
79- window .mainloop ()
80-
81-
82-
96+ otamartCheckButton .grid (row = 2 , column = 2 , sticky = 'w' )
8397
98+ newestSort = tk .BooleanVar ()
99+ newestSortButton = tk .Checkbutton (
100+ window , text = "新品顺" , variable = newestSort , onvalue = True , offvalue = False , height = 0 , width = 0 )
101+ newestSortButton .select ()
102+ newestSortButton .grid (row = 3 , column = 0 , sticky = 'w' )
84103
104+ window .mainloop ()
0 commit comments