{"id":41776,"date":"2020-02-22T22:45:16","date_gmt":"2020-02-22T14:45:16","guid":{"rendered":"http:\/\/4563.org\/?p=41776"},"modified":"2020-02-22T22:45:16","modified_gmt":"2020-02-22T14:45:16","slug":"virmach-%e5%8f%aa%e9%9c%80%e4%bb%98%e6%ac%be%e7%9a%84%e5%85%a8%e8%87%aa%e5%8a%a8%e8%84%9a%e6%9c%ac-seleniumchrome","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=41776","title":{"rendered":"VIRMACH \u53ea\u9700\u4ed8\u6b3e\u7684\u5168\u81ea\u52a8\u811a\u672c selenium+chrome"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>beng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:28:22\t<\/p>\n<h3>VIRMACH \u53ea\u9700\u4ed8\u6b3e\u7684\u5168\u81ea\u52a8\u811a\u672c selenium+chrome<\/h3>\n<p>  \t\t1. \u62a2\u8d2d\u7684\u914d\u7f6e\u7b49\u4e8e\u6216\u9ad8\u4e8e\u4f60\u7684\u914d\u7f6e\u8981\u6c42<br \/>  2.\u58f0\u97f3\u63d0\u793a<br \/>  3.\u81ea\u52a8\u52a0\u5165\u8d2d\u7269\u8f66\uff0c\u53ea\u9700\u542c\u5230\u63d0\u793a\u97f3\u4ed8\u6b3e\uff0c\u5168\u81ea\u52a8<br \/>  4.\u9700\u8981\u5b89\u88c5\u597drequests\u548c selenium<\/p>\n<p>  \u9700\u8981\u4fee\u6539\u7684\u5730\u65b9\uff1a<br \/>  1.settings\u6309\u7167\u81ea\u5df1\u8981\u6c42\u4fee\u6539<br \/>  2.chromedriver\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c<br \/>  driver = webdriver.Chrome(executable_path=&#8217;E:Work Areachromedriver.exe&#8217;, options=options)\u4e2dexecutable_path\u6362\u6210\u4f60\u81ea\u5df1\u7684<\/p>\n<p>  import requests<br \/>  import json<br \/>  import re<br \/>  import time<br \/>  import sys<br \/>  import winsound<\/p>\n<p>  from selenium import webdriver<\/p>\n<p>  settings = {<br \/>  &nbsp; &nbsp; &#8216;price&#8217;: 15,<br \/>  &nbsp; &nbsp; &#8216;virt&#8217;: &#8216;KVM&#8217;,<br \/>  &nbsp; &nbsp; &#8216;ram&#8217;: 2000,<br \/>  &nbsp; &nbsp; &#8216;cpu&#8217;: 2,<br \/>  &nbsp; &nbsp; &#8216;hdd&#8217;: 20,<br \/>  &nbsp; &nbsp; &#8216;bw&#8217;: 1000,<br \/>  &nbsp; &nbsp; &#8216;ips&#8217;: 1,<br \/>  }<\/p>\n<p>  url = &#8216;https:\/\/billing.virmach.com\/modules\/addons\/blackfriday\/new_plan.json&#8217;<\/p>\n<p>  options = webdriver.ChromeOptions()<br \/>  options.add_argument(&#8216;&#8211;incognito&#8217;)<br \/>  options.add_argument(&#8216;&#8211;disable-gpu&#8217;)<\/p>\n<p>  driver = webdriver.Chrome(executable_path=&#8217;E:Work Areachromedriver.exe&#8217;, options=options)<br \/>  driver.get(&#8216;https:\/\/www.baidu.com&#8217;)<\/p>\n<p>  def run():<br \/>  &nbsp; &nbsp; response = json.loads(requests.get(url).text)<br \/>  &nbsp; &nbsp; price = response[&#8216;price&#8217;]<br \/>  &nbsp; &nbsp; if &#8216;yr&#8217; in price:<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;price = float(re.findall(&#8216;$(.+?) &lt;span&gt;\/yr&lt;\/span&gt;&#8217;, price))<br \/>  &nbsp; &nbsp; virt = response[&#8216;virt&#8217;]<br \/>  &nbsp; &nbsp; ram = int(response[&#8216;ram&#8217;])<br \/>  &nbsp; &nbsp; cpu = int(response[&#8216;cpu&#8217;])<br \/>  &nbsp; &nbsp; hdd = int(response[&#8216;hdd&#8217;])<br \/>  &nbsp; &nbsp; bw = int(response[&#8216;bw&#8217;])<br \/>  &nbsp; &nbsp; ips = int(response[&#8216;ips&#8217;])<br \/>  &nbsp; &nbsp; pid = response[&#8216;pid&#8217;]<br \/>  &nbsp; &nbsp; location = response[&#8216;location&#8217;]# BUFFALO<br \/>  &nbsp; &nbsp; if price &lt;= settings[&#8216;price&#8217;] and virt == settings[&#8216;virt&#8217;] and ram &gt;= settings[&#8216;ram&#8217;] and cpu &gt;= settings[<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&#8216;cpu&#8217;] and hdd &gt;= settings[&#8216;hdd&#8217;] and bw &gt;= settings[&#8216;bw&#8217;] and ips &gt;= settings[&#8216;ips&#8217;]:<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;driver.get(&#8216;https:\/\/billing.virmach.com\/cart.php?a=add&amp;pid=&#8217; + str(pid))<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;winsound.Beep(500, 1000)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;print(price)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;print(cpu, &#8216;H&#8217;, ram, &#8216;M&#8217;, bw, &#8216;G&#8217;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;print(&#8216;hdd:&#8217;, hdd, &#8216;G&#8217;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;if ips &gt; 1:<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;print(ips)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;print(location)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;print(&#8216;https:\/\/billing.virmach.com\/cart.php?a=add&amp;pid=&#8217; + str(pid))<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;return True<br \/>  &nbsp; &nbsp; else:<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;item = &#8216;\u65e0\u7b26\u5408\u673a\u5668 &#8216; + time.strftime(&quot;%H:%M:%S %Y-%m-%d&quot;, time.localtime())<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;sys.stdout.write(&#8216;r&#8217; + str(item) + &#8216;\u000033[K&#8217;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;sys.stdout.flush()<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;return False<\/p>\n<p>  while 1:<br \/>  &nbsp; &nbsp; if run():<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;break<br \/>  &nbsp; &nbsp; time.sleep(5)<\/p>\n<p>  \u56e0\u4e3aselenium\u542f\u52a8\u6bd4\u8f83\u6162 \u6240\u4ee5\u811a\u672c\u5f00\u59cb\u7684\u65f6\u5019\u4f1a\u4e8b\u5148\u6253\u5f00\u4e00\u4e2a\u7f51\u9875<br \/>  \u62a2\u8d2d\u5230\u811a\u672c\u4f1a\u6682\u505c\uff0c\u7b49\u5f85\u4ed8\u6b3e\uff0c\u9700\u8981\u91cd\u65b0\u8fd0\u884c\u5f00\u59cb\u4e0b\u4e00\u8f6e<\/p>\n<p>  \u840c\u65b0\uff0c\u811a\u672c\u6709\u5176\u4ed6\u95ee\u9898\uff0c\u6b22\u8fce\u53cd\u9988 \u4ee3\u7801\u4e11\u52ff\u55b7\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>jpfree<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:30:26\t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 jpfree \u4e8e 2019-11-29 17:32 \u7f16\u8f91 <\/p>\n<p> \u4e0d\u4f1a\u554a\uff0c\u5927\u4f6c\u3002\u6c42\u8be6\u7ec6<\/p>\n<p>  \u8fd8\u662f\u8fd9\u4e2a\u7b80\u5355\uff0c\u65e0\u9700\u73af\u5883\u3002\u624b\u673a\u4e0a\u4e5f\u53ef\u4ee5\u64cd\u4f5c\u3002<br \/>  1\uff0c\u770b\u8fd9\u4e2a\uff1a\u6709PLANID\u5c31\u662f\u8fd8\u6709\u8d27\uff0c\u6ca1\u8d27\u6709END\u3002<\/p>\n<p>  https:\/\/billing.virmach.com\/modules\/addons\/blackfriday\/new_plan.json<\/p>\n<p>  2\uff0c\u70b9\u8fd9\u4e2a\u8d2d\u4e70\uff0c\u65e0\u8bba\u54ea\u4e2a\u90fd\u53ef\u4ee5\u6dfb\u52a0\uff0c\u6709\u8d27\u7684\u65f6\u5019\u70b9\uff1a<br \/>  https:\/\/virmach.com\/manage\/aff.php?aff=8640&amp;pid=175\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>ApkB<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:32:00\t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 ApkB \u4e8e 2019-11-29 17:44 \u7f16\u8f91 <\/p>\n<p> \u6709\u4e2a\u91cd\u8981\u7684\u56e0\u7d20\u6ca1\u8003\u8651\u554a\uff0c\u5c31\u662f\u673a\u623f\u554a<br \/>  \u76ee\u524d\u88ab\u62a2\u7684\u90fd\u662f\u5723\u4f55\u585e\uff0c\u5f53\u7136\uff0c\u76ee\u524d\u4e5f\u53ea\u6709\u8fd9\u4e24\u4e2a\u914d\u7f6e\u6bd4\u8f83\u4fbf\u5b9c:Q<\/p>\n<p>  \u6211\u628a\u521a\u624d\u8c01\u53d1\u7684 lidan00 \u53d1\u7684\u4ee3\u7801\u7a0d\u6539\u4e86\u4e0b\uff0c\u52a0\u5165\u4e86\u5224\u65ad\u673a\u623f\uff0c\u9700\u8981\u7684\u53ef\u4ee5\u628a\u673a\u623f\u5730\u5740\u6539\u4e0b\u3002<br \/>  \u63d0\u793a\uff1a\u52a0\u4e86\u6211\u7684AFF:$ <\/p>\n<p>  \u6d4f\u89c8\u5668\u6253\u5f00\u4efb\u610f\u7f51\u7ad9,F12\u6253\u5f00\u63a7\u5236\u53f0,\u7c98\u8d34\u8fd0\u884c<br \/>  like \u662f\u91d1\u989d\uff0clocastr \u662f\u673a\u623f\uff0c\u6309\u9700\u8981\u4fee\u6539\u4e0b<\/p>\n<p>  San Jose, CA&nbsp; &nbsp;&#8212;-\u5723\u4f55\u585e<br \/>  BUFFALO, NY&nbsp; &nbsp;<br \/>  LOS ANGELES, CA<br \/>  DALLAS, TX<br \/>  PISCATAWAY, NJ<\/p>\n<p>  const aff = 8973<br \/>  const like = 10<br \/>  const locastr = &quot;San Jose, CA&quot;<br \/>  const new_plan =<br \/>  &#8216;https:\/\/billing.virmach.com\/modules\/addons\/blackfriday\/new_plan.json&#8217;<br \/>  const add = `https:\/\/virmach.com\/manage\/aff.php?aff=${aff}&amp;pid=175`<br \/>  Notification.requestPermission()<br \/>  let pre = &#8221;<br \/>  const main = async () =&gt; {<br \/>  let a = await fetch(new_plan)<br \/>  a = await a.json()<br \/>  cur = JSON.stringify(a)<br \/>  console.log(cur)<br \/>  if (pre === cur) {<br \/>  &nbsp; &nbsp; return<br \/>  }<br \/>  pre = cur<br \/>  b = parseFloat(a.price.match(\/([d.]+)\/))<br \/>  c = a.location<br \/>  console.log(b)<br \/>  console.log(c)<br \/>  if (b &lt; like &amp;&amp; c == locastr ) {<br \/>  &nbsp; &nbsp; new Notification(b)<br \/>  &nbsp; &nbsp; window.open(add)<br \/>  }<br \/>  }<br \/>  main()<br \/>  setInterval(main, 5000)\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>plumn<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:42:58\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6211\u5c31\u653e\u8fd9\u4e86\u8ddf\u4f60\u4eec\u8bf4\uff0c\u53bb\u5e74\u4e00\u6ce2\u811a\u672c\u5927\u4f6c\u88ab8c8g 100gb\u6d41\u91cf\u5927\u6c34\u725b\u5751\u4e86\u4e00\u6ce2\uff0c\u4eca\u5e74\u4f60\u4eec\u7ee7\u7eed\u6298\u817e\uff0c\u6211\u5c31\u4e0d\u4fe1virmach\u7a0b\u5e8f\u5458\u5230\u65f6\u5019\u4e0d\u7ed9\u4f60\u4eec\u4e2a\u5e7a\u86fe\u5b50\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>beng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:32:05\t<\/p>\n<h3><\/h3>\n<p>  \t\tjpfree \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:30<br \/>  \u4e0d\u4f1a\u554a\uff0c\u5927\u4f6c\u3002\u6c42\u8be6\u7ec6<\/p>\n<p> http:\/\/npm.taobao.org\/mirrors\/chromedriver<br \/>  \u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c \u6539\u4e0b\u5730\u5740 \u8fd0\u884c\u5c31\u884c\u4e86 \u542c\u5230\u58f0\u97f3\u4ed8\u6b3e<br \/>  \u53ef\u4ee5\u5148\u62ff\u5f53\u524d\u5b98\u7f51\u914d\u7f6e\u8bd5\u8bd5\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>fenghuang<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:32:23\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u597d\u50cf\u548c\u7528\u6d4f\u89c8\u5668\u6253\u5f00\u4e0b\u5355\u5730\u5740\u4e00\u6837\u6548\u679c \u76f4\u63a5 webbrowser.open(url)\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>zeroz<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:32:50\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u52a0\u4e2a try\u5427\uff0c\u4e0d\u7136\u5f88\u53ef\u80fd\u8dd1\u7740\u5c31\u6302\u4e86\uff0c\u8fd8\u4e0d\u77e5\u9053\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>beng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:33:13\t<\/p>\n<h3><\/h3>\n<p>  \t\tfenghuang \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:32<br \/>  \u597d\u50cf\u548c\u7528\u6d4f\u89c8\u5668\u6253\u5f00\u4e0b\u5355\u5730\u5740\u4e00\u6837\u6548\u679c \u76f4\u63a5 webbrowser.open(url)<\/p>\n<p> \u6015affman\u5f00\u7684\u65e0\u75d5 \u54c8\u54c8\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>beng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:34:18\t<\/p>\n<h3><\/h3>\n<p>  \t\tApkB \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:32<br \/>  \u6709\u4e2a\u91cd\u8981\u7684\u56e0\u7d20\u6ca1\u8003\u8651\u554a\uff0c\u5c31\u662f\u673a\u623f\u554a<br \/>  \u76ee\u524d\u88ab\u62a2\u7684\u90fd\u662f\u5723\u4f55\u585e\uff0c\u5f53\u7136\uff0c\u76ee\u524d\u4e5f\u53ea\u6709\u8fd9\u4e24\u4e2a\u914d\u7f6e\u6bd4\u8f83\u4fbf\u5b9c &#8230;<\/p>\n<p> \u6211\u5728\u8bb0\u5f55\u6bcf\u4e2a\u5730\u533a\u7684\u5b57\u6bb5 \u6ca1\u5b57\u6bb5\u4e0d\u597d\u5224\u65ad \u5927\u4f6c\u6709\u6240\u6709\u5730\u533a\u7684\u5b57\u6bb5\u5417 \u6211\u52a0\u4e0a\u53bb\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>ncnc<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:34:44\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd9\u4e2a\u5389\u5bb3\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>beng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:35:30\t<\/p>\n<h3><\/h3>\n<p>  \t\tzeroz \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-11-29 17:32<br \/>  \u52a0\u4e2a try\u5427\uff0c\u4e0d\u7136\u5f88\u53ef\u80fd\u8dd1\u7740\u5c31\u6302\u4e86\uff0c\u8fd8\u4e0d\u77e5\u9053<\/p>\n<p> \u4e0d\u80fd\u52a0try\u5427 \u4e0d\u7136\u4f60\u7684ip\u88ab\u5c4f\u853d\u90fd\u4e0d\u77e5\u9053\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>beng \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/41776"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41776"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/41776\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41776"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}