コード例 #1
0
 def __init__(self):
     self.__headers = uapi.header
     self.session = settings.Session()
     modulus = uapi.comment_module
     pubKey = uapi.pubKey
     secKey = uapi.secKey
     self.__encSecKey = self.rsa_encrypt(secKey, pubKey, modulus)
コード例 #2
0
 def __init__(self):
     self.__headers = default.header
     self.session = settings.Session()
     text = default.comment_text
     modulus = default.comment_module
     pubKey = default.pubKey
     secKey = default.secKey
     self.__encSecKey = self.rsaEncrypt(secKey, pubKey, modulus)
コード例 #3
0
ファイル: comment.py プロジェクト: zongmingshu/spider163
 def __init__(self, music_type=Common):
     self.__headers = uapi.header
     self.music_type = music_type
     self.session = settings.Session()
     modulus = uapi.comment_module
     pubKey = uapi.pubKey
     secKey = uapi.secKey
     self.__encSecKey = self.rsaEncrypt(secKey, pubKey, modulus)
コード例 #4
0
ファイル: read.py プロジェクト: rex3092/123
def print_comment(count):
    session = settings.Session()
    comments = session.query(pysql.Comment163).order_by(
        desc(pysql.Comment163.liked)).limit(count)
    document = Document()
    workbook = Workbook()
    try:
        document.add_heading("TOP {} 评论".format(count), 0)
        sheet = workbook.add_sheet("TOP {} 评论".format(count))
        i = 0
        sheet.write(i, 0, "歌曲名字")
        sheet.write(i, 1, "评论作者")
        sheet.write(i, 2, "评论内容")
        sheet.write(i, 3, "点赞数量")
        sheet.write(i, 4, "歌曲链接")
        for c in comments:
            i = i + 1
            song = session.query(
                pysql.Music163).filter(pysql.Music163.song_id == c.song_id)
            pylog.print_info("正在填充第 {} 条评论,歌曲:{}".format(i, song[0].song_name))
            document.add_paragraph().add_run(
                "作者:{}".format(c.author)
            ).font.color.theme_color = MSO_THEME_COLOR_INDEX.ACCENT_2
            document.add_paragraph().add_run("内容:{}".format(
                c.txt)).font.color.theme_color = MSO_THEME_COLOR_INDEX.ACCENT_2
            document.add_paragraph().add_run(
                "歌曲:《{}》 链接:http://music.163.com/#/song?id={}".format(
                    song[0].song_name, c.song_id
                )).font.color.theme_color = MSO_THEME_COLOR_INDEX.ACCENT_2
            document.add_paragraph().add_run(
                "赞同:{}".format(c.liked)
            ).font.color.theme_color = MSO_THEME_COLOR_INDEX.ACCENT_2
            document.add_paragraph("")

            sheet.write(i, 0, song[0].song_name)
            sheet.write(i, 1, c.author)
            sheet.write(i, 2, c.txt)
            sheet.write(i, 3, c.liked)
            sheet.write(i, 4,
                        "http://music.163.com/#/song?id={}".format(c.song_id))

    except Exception as e:
        pylog.print_warn(e)
    document.save("TOP {} 评论.docx".format(count))
    pylog.print_warn("\n完成文档 TOP {} 评论.docx 的生成!\n".format(count))

    workbook.save("TOP {} 评论.xls".format(count))
    pylog.print_warn("\n完成文档 TOP {} 评论.xls 的生成!\n".format(count))
コード例 #5
0
 def __init__(self):
     self.__headers = default.header
     self.__url = default.music_url
     self.session = settings.Session()
コード例 #6
0
 def __init__(self):
     self.__headers = uapi.header
     self.__play_url = uapi.play_url
     self.session = settings.Session()