zoukankan      html  css  js  c++  java
  • 【python小工具】我在bilibili个人资料里控制家里的电脑

    今天在52学习到的,大佬A是在网易云音乐   歌单设置  里,过程没看到,封装一个exe了,可以控制本地cmd命令

    思路很奇特,想了一下感觉实现应该简单,就打算自己实现一下

    两步走;网页正则和本地os.system调用....

    实现确实很简单,但是思路很奇特有没有

    代码很low,主要学习思路学习思路

    python版本3.X

    from urllib import request
    import io,sys,re,time
    sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')
    import os
    import time
    import subprocess
    #https://www.cnblogs.com/-admin-login-aspx/

    class Spider(): url_num = input('http://space.bilibili.com/*******:') url = ("http://space.bilibili.com/"+url_num) #url='http://space.bilibili.com/19523178' one_pattern = 'QAQ([sS]*?)QAQ' #main_one_pattern = '' def fetch_content(self): r = request.urlopen(Spider.url) htmls = r.read() htmls = str(htmls,encoding='utf-8') #print (htmls) return htmls def analysis(self,htmls): one_html = re.findall(Spider.one_pattern,htmls) # print (one_html) one_html=one_html[0] return one_html def local_cmd(self,one_html): os.system(one_html) #os.system(r'taskkill /F /IM YoudaoNote.exe') print('ok!') def loop_cmd(self): while 1: time.sleep(1) htmls = self.fetch_content() self.local_cmd(self.analysis(htmls)) def main(self): self.loop_cmd() spider = Spider() spider.main()#https://www.cnblogs.com/-admin-login-aspx/

    代码放github上

  • 相关阅读:
    mock.js 模拟数据
    pa
    观察者模式
    WebSocket
    Nginx官方文档学习
    Java中文乱码解决
    Jersey+Spring+Maven(转)
    App架构经验总结(转)
    JSONP跨域的原理解析(转)
    mongoDB学习
  • 原文地址:https://www.cnblogs.com/-admin-login-aspx/p/10324145.html
Copyright © 2011-2022 走看看