首页 编程教程正文

python聊妹又一巅峰力作,从此深夜妹子对你撩骚不断,哎

piaodoo 编程教程 2020-02-22 22:02:20 844 0 python教程

本文来源吾爱破解论坛

本帖最后由 yx_robert 于 2019-3-24 09:29 编辑

运行后,微信自动搜索,回复电影资源
并且提供下载链接

只要妹子微信你, 亲爱的我想看电影xxxx
立即回复电影下载链接, 当然,可以更骚
代码简单, 效果甚佳

至于如何部署
yx_chat.py 第一个文件
yx_search_movie.py 第二个文件
放在同路径下
当然,需要安装python
还有需要的那些库,用pip安装不能太简单了
python yx_chat.py 后,微信扫码 确任登录就ok了
相当于登录了pc版的微信

python真是简单的不能再简单好用的不能在好用的语言了
没错 学会python 你就可以像我一样为所欲为

IMG_4066(20190321-225231).jpg (224.9 KB, 下载次数: 2)

下载附件  保存到相册

2019-3-21 22:56 上传



[Python] 纯文本查看 复制代码
#! /usr/bin/env python
# -*- coding: UTF-8 -*-


import itchat, time
import sys
import yx_web_search as yx


reload(sys)
sys.setdefaultencoding('utf-8')

dear_list = [u'老妹3']
key = u"我想看电影"

movie_list = {u"小偷家族":"magnet:?xt=urn:btih:047FCD07C11D153A8B7A724D4C253BF373AEF115"}

@itchat.msg_register(['Text', 'Map', 'Card', 'Note', 'Sharing'])
def text_reply(msg):

        # itchat.send('%s: %s'%(msg['Type'], msg['FromUserName']), msg['FromUserName'])
        # if msg['FromUserName'] in dear_list:

        idx = msg['Text'].find(key)
        # content = 'good 进入第二步了 %d' % idx
        # itchat.send('%s: %s'%(msg['Type'], content), msg['FromUserName'])

        if idx != -1:
                name = msg['Text'][idx + len(key):].strip()
                print name
                content = 'Good 稍等一下 亲爱的 %s 马上送达' % name
                itchat.send('%s: %s'%(msg['Type'], content), msg['FromUserName'])

                content = yx.get_movie(name)
                if len(content) < 5:
                        content = '没有找到资源哦,没关系,可以带你去电影院去看!'
                        itchat.send('%s: %s'%(msg['Type'], content), msg['FromUserName'])

                        if name in movie_list:
                                time.sleep(10)
                                content = "找到了!\n"
                                itchat.send('%s: %s'%(msg['Type'], content), msg['FromUserName'])
                                time.sleep(3)
                                content = movie_list[name] + "\n"
                                itchat.send('%s: %s'%(msg['Type'], content), msg['FromUserName'])
                                time.sleep(5)
                                content = "看在我这么辛苦的份上,做我的女朋友吧!"
                                itchat.send('%s: %s'%(msg['Type'], content), msg['FromUserName'])
                else:
                        itchat.send('%s: %s'%(msg['Type'], content), msg['FromUserName'])
                



itchat.auto_login(True)
itchat.run()


[Python] 纯文本查看 复制代码
#! /usr/bin/env python
# -*- coding: UTF-8 -*-

from lxml import etree
import requests
import sys
import re
from urllib import quote
from urllib import unquote  
import string

# https://blog.csdn.net/findhappy117/article/details/83748374

reload(sys)
sys.setdefaultencoding('UTF-8')


main_rul = "https://www.ygdy8.com"
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36"}


def request_url(url):
        while True:
                try:
                        r = requests.get(url,headers=header)
                        if r.status_code == 200:
                                r.encoding = 'gbk'
                                return r.text
                except:
                        pass


def get_search_result(film_name):

        film_name = film_name.encode('gb2312')
        name = quote(film_name, safe=string.printable)
        url = "http://s.ygdy8.com/plus/so.php?typeid=1&keyword=%s" % name
        req = requests.get(url, headers=headers)

        req.encoding = 'gbk'
        root = etree.HTML(req.text)

        with open("web.txt", 'w') as f:
                f.write(req.text)

        addr_list = root.xpath(
            '//div[@class="co_content8"]/ul/tr/td[@valign="top"]/table/tr/td[@width="55%"]/b/a/@href')
        name_list = root.xpath(
            '//div[@class="co_content8"]/ul/tr/td[@valign="top"]/table/tr/td[@width="55%"]/b/a/text()')
        
        # print(addr_list)
        # print(name_list)

        # l = parse_name_list(name_list)
        # print(name_list)
        l = []
        for i in name_list:
                s = "%s" % i
                l.append(s)
        # for i in name_list:
        #         print(i)
        # print l
        return addr_list, l


def get_movie_addr(url_addr):
        url_addr = main_rul + url_addr
        # print(url_addr)
        req = requests.get(url_addr, headers=headers)
        req.encoding = 'gbk'
        root = etree.HTML(req.text)

        # 
        head = url_addr.rfind('/')
        tail = url_addr.rfind('.')
        save_name = url_addr[head+1:tail] + '.txt'
        # print(save_name)
        # with open(save_name, 'w') as f:
        #         f.write(req.text)

        # 
        addr_list = root.xpath(
            '//table[@align="center"]/tbody/tr/td/a/@href')

        # print addr_list
        l = []
        for i in addr_list:
                s = "%s" % i
                l.append(s)

        return l


def get_movie(movie_name):
        movie_list, name_list = get_search_result(movie_name)
        addr_list = []
        for i in movie_list:
                addr_list.append(get_movie_addr(i))

        if len(movie_list) <= 0:
                return ""
        
        content = "电影列表:\n"
        n = 0
        for i in name_list:
                if n%2 == 0:
                        content += str(i)
                        content += movie_name
                else:
                        content += str(i) + "\n"
                n += 1
        content += "\n\n"
        content += "下载链接:\n"
        for i in addr_list:
                content += str(i[0].strip()) + "\n\n"
        content += "\n"

        print content
        return content

def main():

        # file_name = "蝙蝠侠"
        file_name = "小偷家族"
        get_movie(file_name)

        # addr_list, name_list = get_search_result(file_name)
        # for i in addr_list:
        #         get_movie_addr(i)
        #         # break
        # get_movie_addr("/html/gndy/dyzz/20120326/36995.html")


        # with open(save_file, 'w') as f:
        #         for i in movie_list:
        #                  f.write(i[0] + '\n')
        #                 f.write(i[1] + '\n\n')
        #         f.close()


if __name__ == "__main__":
        main()


大家努力送我去影视区啊
没错,那我可以让妹子们更加对你欲罢不能


版权声明:

本站所有资源均为站长或网友整理自互联网或站长购买自互联网,站长无法分辨资源版权出自何处,所以不承担任何版权以及其他问题带来的法律责任,如有侵权或者其他问题请联系站长删除!站长QQ754403226 谢谢。

有关影视版权:本站只供百度云网盘资源,版权均属于影片公司所有,请在下载后24小时删除,切勿用于商业用途。本站所有资源信息均从互联网搜索而来,本站不对显示的内容承担责任,如您认为本站页面信息侵犯了您的权益,请附上版权证明邮件告知【754403226@qq.com】,在收到邮件后72小时内删除。本文链接:https://www.piaodoo.com/7381.html

搜索