[Python]Amazonã¢ãœã·ãšã€ããHUGOããã°ã«è²Œãã®ãå°ãç°¡åã«
HUGOã®èšäºã«amazonã¢ãœã·ãšã€ããªã³ã¯ã貌ãéã«ãååŸãããªã³ã¯ãå å·¥ããã®ãé¢åã ã£ãã®ã§ãpythonã§æžããŸãã tkinterã§GUIã«ããŠããŸã ãªããŠããšã¯ãªããäžèº«ã¯æååãåã£ãŠè²Œã£ãŠãããŠããã ãã§ã ã³ãã³ãã§èµ·åããã®ã¯é¢åãªã®ã§ãããããã¡ã€ã«ã§èµ·åããããã«ããŠããŸã äœãããšããŠãããªã³ã¯ ãããªèŠãç® å€é¢šã ãã©èªåã¯ããã奜ã å®éã®ãªã³ã¯ã¯ããâïŒãªã³ã¯åããŠãããã¹ããã»ã³ïŒ 䜿ãæ¹ ãAmazonã¢ãœã·ãšã€ãããŒã«ããŒãã®ãããã¹ããšç»åãã¿ããéããŠãçæããããªã³ã¯ãã³ããŒïŒäžç»åã®ããããã³ããŒãéšåïŒ pythonããã°ã©ã ãèµ·åãããšãããçŸããâ ã³ããŒãããªã³ã¯ããã®ãŸãŸè²Œãä»ãã ãšã³ã¿ãŒããŒãæŒããšãã¯ãªããããŒãã«ã³ããŒããã èšäºå ã«è²Œãä»ãã ã³ããŒãããæååäŸâïŒè¡šç€ºã®éœåäžãå é ã®{ã¯å šè§ã«ãªã£ãŠããŸãããå®éã¯åè§{ã§ãïŒ ïœ{< Amazon src="//rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=ã¢ãœã·ãšã€ãID&language=ja_JP&o=9&p=8&l=as4&m=amazon&f=ifr&ref=as_ss_li_til&asins=B088PGN64G&linkId=2ef7d1928670c9537cf1976fdc5a5b37" >}} ã¯ãªã¢ãã¿ã³ãæŒããšæ¶ãã 2åç®ä»¥éã¯ãã¯ãªããããŒãã«ã³ããŒããŸããïŒãã¯æ¶ããªãã®ã§æ³šæ ããã°ã©ã ã¯ãªããããŒããæ±ãã©ã€ãã©ãªãŒïŒpyclipïŒã¯ã€ã³ã¹ããŒã«ãå¿ èŠã§ã 衚瀺ã®éœåäžãäžéšã®{ã¯å šè§ã«ãªã£ãŠããŸãããå®éã¯åè§{ã§ãã䜿çšã®éã¯åè§{ã«çŽããŠã䜿ããã ãã # -*- coding: utf-8 -*- """ ã¢ããŸã³ã®ååãªã³ã¯ãhugoã«è²Œã圢ã«å€æãã ãšã³ã¿ãŒã§å€æ ã¯ãªããããŒãã«ã³ããŒããã """ import tkinter as tk import pyclip root = tk.Tk() root.geometry('500x90') root.title('Amazon affiãªã³ã¯å€æ(hugoçš)') def func(event): global label1 text1 = entry1.get() # amazon ã¢ãœã·ãšã€ãããŒã«ã㌠ããã¹ããšç»åã®ãªã³ã¯ target = 'src="' # src="ããåŸããæœåº idx = text1.find(target) r = text1[idx + len(target):] r = r[:-10] # åŸãã® ></iframe> ãåé€ r = 'src="' + str(r) # æŽåœ¢ r = 'ïœ{< Amazon ' + r + ' >}}' # æŽåœ¢ pyclip....