由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Outdoors版 - 写了个 SAC的抓deal code
相关主题
SAC上的天价帐篷Sierra Designs Lightning 2 Tent with Footprint - 2-Person 3 (转载)
a good tent on SAC nowSAC water tight Arc'teryx backpack
Mountain hardwear sub zero down jacketGregory Iris Backpack - Women's值得买吗?
baselayer除了买Under Armour还有什么好牌子?SAC 卖 jansport backpack
backpacking tent 要买多重以下的?STP有啥好点的backpack吗
包子求推荐个性价比高的的backpacking down sleeping baglooking for thanksgiving backpacking buddy
Rae Lake Backpacking - 题记新西兰backpacking的情况
请推荐一款适合backpacking的睡袋Recommendation on really warm sleeping bags
相关话题的讨论汇总
话题: outmsg话题: match话题: infoline话题: line话题: import
进入Outdoors版参与讨论
1 (共1页)
m***f
发帖数: 732
1
抓到你想要的deal自动给你发email或短消息,有兴趣的下去改了用。直接拷贝下面这
段code修改后存为sac.py,然后运行python sac.py即可。在python 2.7下测试通过。
#!/usr/bin/python
import re
import urllib
import smtplib
import time
from email.mime.text import MIMEText
target=[['trekking', 'poles'],['Napali', 'Backpack'],['north', 'face'],['
oakley','battalion']] #The items you want to monitor, in every set of [] AND
logical will be used to match a specific item
discount_threshold=50 #threshold of percentage to trigger event
check_interval=60 #the interval to refresh in unit of second
hourstart=8 #what time you want this start to send you sms by hour
hourstop=22 #waht time you want this to stop by hour
smtpserver='smtp.mail.yahoo.com' #smtp email server you want to use
smtpport=25 # port number of smtp server
fromadd='s*****[email protected]' #email sender address
toadd='6********[email protected]' #email recipent address, use cellphone sms
gateway address to send sms to your cellphone
user='someone' #put your email account name here
passwd='xxxxxx' #put your email account passwd here
oldinfoline=''
while True:
ctime=time.localtime()[3]
if ctime>hourstart and ctime a=urllib.urlopen('http://www.steepandcheap.com')
lines=a.readlines()
item_m=re.compile('Steep and Cheap:')<br /> discount_m=re.compile('discount:')<br /> price_m=re.compile('price:')<br /> #infoline='<title>Steep and Cheap: Mountain Hardwear Napali 50<br /> Backpack - 2850-3050cu in - Womens - $69.99 - 63% off<title>\n'<br /> for line in lines:<br /> line=line.strip()<br /> if item_m.match(line):<br /> infoline=line<br /> if discount_m.match(line):<br /> discountline=line<br /> if price_m.match(line):<br /> priceline=line<br /> if infoline!=oldinfoline:<br /> oldinfoline=infoline<br /> outmsg=''<br /> n_match=re.compile('\d+\.*\d*')<br /> price=float((n_match.search(priceline)).group())<br /> discount=float((n_match.search(discountline)).group())<br /> infoline2=infoline.upper()<br /> match=0<br /> for tr in target:<br /> test=1<br /> for trf in tr:<br /> if infoline2.find(trf.upper())<0:<br /> test=0<br /> if test==1:<br /> match=1<br /> for tar in tr:<br /> outmsg+=tar<br /> outmsg+=' '<br /> outmsg+='$'<br /> outmsg+=str(price)<br /> break<br /> info=infoline[7:][:-8]<br /> if match==1:<br /> em=smtplib.SMTP(smtpserver,smtpport)<br /> em.login(user,passwd)<br /> msg=MIMEText(info)<br /> msg['Subject']=outmsg #squeeze so you don't need to download<br /> the actual message<br /> msg['From']=fromadd<br /> msg['To']=toadd<br /> em.sendmail(fromadd,toadd,msg.as_string())<br /> em.quit()<br /> time.sleep(check_interval)</span></div></td></tr><tr><td class="zt-author">T*********e<br />发帖数: 39815</td><td width=80% class="zt-bg"><div id="post2" style="position:relative"><div class="zt-counter">2</div><span>赞<br /> 想买东西的方便了<br /> 不过,我就不用了,最近又买了不少东西,看着信用卡的高额账单发愁<br /> <br /> AND<br /> <br />【在 m***f 的大作中提到】<a href="#post1"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 抓到你想要的deal自动给你发email或短消息,有兴趣的下去改了用。直接拷贝下面这<br />: 段code修改后存为sac.py,然后运行python sac.py即可。在python 2.7下测试通过。<br />: #!/usr/bin/python<br />: import re<br />: import urllib<br />: import smtplib<br />: import time<br />: from email.mime.text import MIMEText<br />: target=[['trekking', 'poles'],['Napali', 'Backpack'],['north', 'face'],['<br />: oakley','battalion']] #The items you want to monitor, in every set of [] AND</span><br /></span></div></td></tr><tr><td class="zt-author">p**********t<br />发帖数: 2636</td><td width=80% class="zt-bg2"><div id="post3" style="position:relative"><div class="zt-counter">3</div><span>牛!<br /> <br /> AND<br /> <br />【在 m***f 的大作中提到】<a href="#post1"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 抓到你想要的deal自动给你发email或短消息,有兴趣的下去改了用。直接拷贝下面这<br />: 段code修改后存为sac.py,然后运行python sac.py即可。在python 2.7下测试通过。<br />: #!/usr/bin/python<br />: import re<br />: import urllib<br />: import smtplib<br />: import time<br />: from email.mime.text import MIMEText<br />: target=[['trekking', 'poles'],['Napali', 'Backpack'],['north', 'face'],['<br />: oakley','battalion']] #The items you want to monitor, in every set of [] AND</span><br /></span></div></td></tr><tr><td class="zt-author">m*****d<br />发帖数: 1613</td><td width=80% class="zt-bg"><div id="post4" style="position:relative"><div class="zt-counter">4</div><span>技术流的。</span></div></td></tr><tr><td class="zt-author">S********t<br />发帖数: 18987</td><td width=80% class="zt-bg2"><div id="post5" style="position:relative"><div class="zt-counter">5</div><span>改成直接下单吧,<br /> 收EMAIL就慢半拍,有好DEAL已经晚了</span></div></td></tr><tr><td class="zt-author">m***f<br />发帖数: 732</td><td width=80% class="zt-bg"><div id="post6" style="position:relative"><div class="zt-counter">6</div><span>这个。。。我对http和python都不熟,要不你动手改改。直接下单风险太大,万一它给<br /> 你一口气来个一百单咋办。<br /> <br />【在 S********t 的大作中提到】<a href="#post5"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 改成直接下单吧,<br />: 收EMAIL就慢半拍,有好DEAL已经晚了</span><br /></span></div></td></tr><tr><td class="zt-author">e**o<br />发帖数: 5509</td><td width=80% class="zt-bg2"><div id="post7" style="position:relative"><div class="zt-counter">7</div><span>主要是有些size区别太大。得先量量,看看size chart才能决定。<br /> <br />【在 S********t 的大作中提到】<a href="#post5"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 改成直接下单吧,<br />: 收EMAIL就慢半拍,有好DEAL已经晚了</span><br /></span></div></td></tr><tr><td class="zt-author">S********t<br />发帖数: 18987</td><td width=80% class="zt-bg"><div id="post8" style="position:relative"><div class="zt-counter">8</div><span>专挑90%那种下,<br /> BTW,我都不会python,<br /> perl倒写过,实在烦的再不想碰了<br /> <br />【在 m***f 的大作中提到】<a href="#post6"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 这个。。。我对http和python都不熟,要不你动手改改。直接下单风险太大,万一它给<br />: 你一口气来个一百单咋办。</span><br /></span></div></td></tr><tr><td class="zt-author">i*****r<br />发帖数: 454</td><td width=80% class="zt-bg2"><div id="post9" style="position:relative"><div class="zt-counter">9</div><span>赞,,,,可不可以改成启动一个聊天机器人去和客服mm打电话???<br /> <br /> AND<br /> <br />【在 m***f 的大作中提到】<a href="#post1"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 抓到你想要的deal自动给你发email或短消息,有兴趣的下去改了用。直接拷贝下面这<br />: 段code修改后存为sac.py,然后运行python sac.py即可。在python 2.7下测试通过。<br />: #!/usr/bin/python<br />: import re<br />: import urllib<br />: import smtplib<br />: import time<br />: from email.mime.text import MIMEText<br />: target=[['trekking', 'poles'],['Napali', 'Backpack'],['north', 'face'],['<br />: oakley','battalion']] #The items you want to monitor, in every set of [] AND</span><br /></span></div></td></tr><tr><td class="zt-author">N**D<br />发帖数: 10322</td><td width=80% class="zt-bg"><div id="post10" style="position:relative"><div class="zt-counter">10</div><span>perl 多好玩<br /> <br />【在 S********t 的大作中提到】<a href="#post8"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 专挑90%那种下,<br />: BTW,我都不会python,<br />: perl倒写过,实在烦的再不想碰了</span><br /></span></div></td></tr><tr><td class="zt-author">m***f<br />发帖数: 732</td><td width=80% class="zt-bg2"><div id="post11" style="position:relative"><div class="zt-counter">11</div><span>python很好学的。我现学现写2小时就搞定这个了。<br /> <br />【在 S********t 的大作中提到】<a href="#post8"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 专挑90%那种下,<br />: BTW,我都不会python,<br />: perl倒写过,实在烦的再不想碰了</span><br /></span></div></td></tr><tr><td class="zt-author">S*A<br />发帖数: 7142</td><td width=80% class="zt-bg"><div id="post12" style="position:relative"><div class="zt-counter">12</div><span>haha. 这个太有才了。<br /> 鸡蛋里面调点骨头,这个 python 一看就是新手写的。不够优美。<br /> 你这个应该可以一次匹配说有的 match text而不需要一行一行来搞的。<br /> python 的 regular expression 还是挺强的。<br /> 还有一个 idea 是用 BeautifulSoup, 一次把说有的 html 都吃进去,<br /> 然后在 DOM tree 里面找就行了。最好的情况有可能几行就行了。<br /> <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">http://www.crummy.com/software/BeautifulSoup/</a><br /> 我没有看懂你要怎么搞,所以没法帮你搞。如果你解释一下这个<br /> 逻辑的话没准我可以试一下。</span></div></td></tr> </table></td></tr> <tr><td> <div><table class="searchpages" style="float: right"><tbody><tr> <td></td> <td>1</td> <td></td> <td>(共1页)</td> </tr> </tbody></table></div> </td></tr> <tr><td><table style="table-layout:fixed;width:90%;margin-left:auto;margin-right:auto"><tr><td style="font-size:120%;text-align:center;padding-top:15px"><a href="//forum.weiming.info/c/151" style="color:#F52887;font-weight:bold;text-decoration:underline">进入Outdoors版参与讨论</a></td></tr></table></td></tr> <tr><td><table style="table-layout:fixed;width:90%;margin-left:auto;margin-right:auto"><tr><th colspan=2 style="color:#F52887;font-size:105%">相关主题</th></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31246673/">Recommendation on really warm sleeping bags</a></td><td>● <a href="/zhuti/Outdoors/31328437/">backpacking tent 要买多重以下的?</a></td></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31267630/">The North Face的号码问题 + Deal info</a></td><td>● <a href="/zhuti/Outdoors/31386965/">包子求推荐个性价比高的的backpacking down sleeping bag</a></td></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31277631/">backcountry.com 20% off</a></td><td>● <a href="/zhuti/Outdoors/31207415/">Rae Lake Backpacking - 题记</a></td></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31278305/">20090419@mt shasta</a></td><td>● <a href="/zhuti/Outdoors/31266037/">请推荐一款适合backpacking的睡袋</a></td></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31267772/">SAC上的天价帐篷</a></td><td>● <a href="/zhuti/Outdoors/31276803/">Sierra Designs Lightning 2 Tent with Footprint - 2-Person 3 (转载)</a></td></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31285807/">a good tent on SAC now</a></td><td>● <a href="/zhuti/Outdoors/31277367/">SAC water tight Arc'teryx backpack</a></td></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31299777/">Mountain hardwear sub zero down jacket</a></td><td>● <a href="/zhuti/Outdoors/31294893/">Gregory Iris Backpack - Women's值得买吗?</a></td></tr><tr><td width=50%>● <a href="/zhuti/Outdoors/31336863/">baselayer除了买Under Armour还有什么好牌子?</a></td><td>● <a href="/zhuti/Outdoors/31322101/">SAC 卖 jansport backpack</a></td></tr></table></td></tr> <tr><td><table style="table-layout:fixed;width:90%;margin-left:auto;margin-right:auto"><tr><th colspan=2 style="color:#F52887;font-size:105%">相关话题的讨论汇总</th></tr><tr><td colspan=2 style="text-align:center;padding-top:10px;font-size:1.1em"><span style="margin-right: 20px"><a href="/huati/outmsg">话题: outmsg</a></span><span style="margin-right: 20px"><a href="/huati/match">话题: match</a></span><span style="margin-right: 20px"><a href="/huati/infoline">话题: infoline</a></span><span style="margin-right: 20px"><a href="/huati/line">话题: line</a></span><span style="margin-right: 20px"><a href="/huati/import">话题: import</a></span></td></tr></table></td></tr> </tbody></table></div> </td></tr> </tbody></table></div> </div> <span class="anchor" id="line-3"></span><span class="anchor" id="bottom"></span></div><div id="pagebottom"></div></div><div class="sidebar"><div dir="ltr" id="SideBar.sidebar" lang="zh"><span class="anchor" id="SideBar.top"></span> <span class="anchor" id="SideBar.line-1"></span><span class="anchor" id="SideBar.line-2"></span><p class="line867"><div id="rankings"><h3>未名新帖统计<span>// 7月16日</span></h3><div><table width=100%><tr><th width=10% align=left>#</th><th width=50% align=left>版面</th><th width=40% align=left>帖数(主题数)</th></tr><tr><td>-</td><td>全站</td><td>4871 (796)</td></tr><tr><td>1</td><td><a title="军事天地" href="/board/Military/">Military</a></td><td>3777 (569)</td></tr><tr><td>2</td><td><a title="股海弄潮" href="/board/Stock/">Stock</a></td><td>341 (51)</td></tr><tr><td>3</td><td><a title="肚皮舞运动" href="/board/Joke/">Joke</a></td><td>117 (17)</td></tr><tr><td>4</td><td><a title="史海钩沉" href="/board/History/">History</a></td><td>116 (3)</td></tr><tr><td>5</td><td><a title="车轮上的传奇" href="/board/Automobile/">Automobile</a></td><td>100 (9)</td></tr><tr><td>6</td><td><a title="美国新闻" href="/board/USANews/">USANews</a></td><td>55 (9)</td></tr><tr><td>7</td><td><a title="人到中年" href="/board/Midlife/">Midlife</a></td><td>45 (1)</td></tr><tr><td>8</td><td><a title="焦点新闻" href="/board/Headline/">Headline</a></td><td>41 (41)</td></tr><tr><td>9</td><td><a title="梦里花落知多少" href="/board/Dreamer/">Dreamer</a></td><td>33 (13)</td></tr><tr><td>10</td><td><a title="二手市场" href="/board/FleaMarket/">FleaMarket</a></td><td>32 (20)</td></tr><tr><td>11</td><td><a title="家居生活" href="/board/Living/">Living</a></td><td>30 (7)</td></tr></table><p>* 这里只显示发帖超过25的版面,努力灌水吧:-)</p></div></div> <span class="anchor" id="SideBar.line-3"></span><div id="matched_content" style="margin: 5px 2px 5px 2px"></div> <span class="anchor" id="SideBar.line-4"></span> <h3 id="SideBar.A.2BU4ZT8k4KdoROylkp-">历史上的今天</h3> <span class="anchor" id="SideBar.line-5"></span><p class="line867"><div class="BlikiSummary" style="margin-bottom:1.2em;margin-left:0.5em"><ol><li><a href="/zhuti/ChineseClassics/31268413/">faintcat妹妹看进来~~</a> 发表于12年前.</li><li><a href="/zhuti/EB23/31380293/">NSC, PD 1/7/2007, EB2, ...</a> 发表于11年前.</li><li><a href="/zhuti/FleaMarket/35696181/">[FBA求购]MJVE2 758 MJVM2 ...</a> 发表于6年前.</li><li><a href="/zhuti/Parenting/31948559/">老生常谈,归与不归</a> 发表于10年前.</li><li><a href="/zhuti/board/31486231/">【申请】Seattle西雅图 版版主——申请人...</a> 发表于9年前.</li><li><a href="/zhuti/NextGeneration/36332471/">宝宝出生,头骨骨折,求祝福</a> 发表于9年前.</li><li><a href="/zhuti/ClassicalMusic/31210935/">求推荐舒缓优美的古典音乐</a> 发表于11年前.</li><li><a href="/zhuti/PhotoGear/34338217/">百分之一的北京人上北大 中国网友愤怒(转载)</a> 发表于10年前.</li><li><a href="/zhuti/pets/31825797/">新人带狗狗Bailey来报道</a> 发表于12年前.</li><li><a href="/zhuti/Football/31468183/">全世界最有价值的运动队</a> 发表于10年前.</li><li><a href="/zhuti/Automobile/35426999/">请问大切诺基的质量如何</a> 发表于6年前.</li><li><a href="/zhuti/_RuS/23459405/">TNND,军版全是BKC</a> 发表于15年前.</li><li><a href="/zhuti/_LoTaYu/31206385/">Inception</a> 发表于12年前.</li><li><a href="/zhuti/Seattle/32526849/">微软的有些家属可真恶心,为了卖保险脸都不要了</a> 发表于10年前.</li><li><a href="/zhuti/Military/39967953/">每周坐高铁的苦逼来说说感受吧!!</a> 发表于9年前.</li></ol></div> <span class="anchor" id="SideBar.line-6"></span> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2229050667028251" crossorigin="anonymous"></script> <!-- SidebarW1 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2229050667028251" data-ad-slot="2711874079" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <span class="anchor" id="SideBar.line-7"></span><span class="anchor" id="SideBar.bottom"></span></div><div id="sidebar-end"></div></div></div><div class="footer"><span class="license">除非另有声明,本站内容采用Creative Commons BY-NC-SA 3.0协议进行许可,转载请注明来自<a href="/">未名观察</a> - <a href="/PrivacyPolicy">隐私政策</a></span><span class="time" lang="zh" dir="ltr">2011-07-24 10:06:12由<span title="admin"><a href="/admin" title="admin">admin</a></span>编辑</span> </div> <script> var _gaq=[['_setAccount','UA-18482428-3'],['_trackPageview'],['_trackPageLoadTime']]; (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; s.parentNode.insertBefore(g,s)}(document,'script')); </script> <script type="text/javascript" src="http://s.skimresources.com/js/27394X857871.skimlinks.js"></script> </body> </html> <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script>