首页 编程教程正文

懒人听书免费收费批量下载

piaodoo 编程教程 2020-02-22 22:16:45 1491 0 python教程

本文来源吾爱破解论坛

[Python] 纯文本查看 复制代码

# -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 21:07:11 2018

@author: fuwen
"""
from subprocess import call
import requests, base64, json, time, os, re

BookID = 4473

account = '3512060971@bccto.me'
password = 'f0384319'

FilePath = r'D:\有声小说\死灵法师_闲人初'
#使用IDM下载
IdmPath = 'C:\idman_lv\IDMan.exe'
def IdmDownLoad(DownloadUrl, Mp3Name):
    call([IdmPath, '/d',DownloadUrl,'/p',FilePath,'/f',Mp3Name,'/n'])
    
def ChangeFileName(filename):
    filename = filename.replace('\\','')
    filename = filename.replace('/','')
    filename = filename.replace(':','')
    filename = filename.replace('*','')
    filename = filename.replace('“','')
    filename = filename.replace('”','')
    filename = filename.replace('<','')
    filename = filename.replace('>','')
    filename = filename.replace('|','')
    filename = filename.replace('?','?')
    filename = filename.replace('(','(')
    filename = filename.replace(chr(65279),'') # UTF-8+BOM
#    print(ord(filename[0]))
    filename = filename.split('(')[0]
    return filename

Mp3ListJsonUrl = 'http://m.lrts.me/ajax/getBookMenu?bookId=%d&pageNum=1&pageSize=5000&sortType=0'%(BookID)
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36'}
ba_password = base64.b64encode(bytes(password,'ascii'))
LoginUrl = 'http://m.lrts.me/ajax/logon'
conn = requests.session()
PostData = {"account":account,"pwd":ba_password}
rep = conn.post(LoginUrl, data=PostData)
Mp3ListJson = conn.get(Mp3ListJsonUrl, headers = headers)
Mp3ListJson = json.loads(Mp3ListJson.text)
Mp3List = Mp3ListJson['list']
Mp3NameList = [Mp3dict['name'] for Mp3dict in Mp3List]
Mp3NameList = [ChangeFileName(i) for i in Mp3NameList]

AlreadyDown = [FileName.replace('.mp3','') for FileName in os.listdir(FilePath)]
Count = 0
for Mp3Name in Mp3NameList :
    Count+=1
    if Mp3Name in AlreadyDown :
        continue
    Mp3JsonUrl = 'http://m.lrts.me/ajax/getPlayPath?entityId=%d&entityType=3&opType=1§ions=[%d]&type=0'%(BookID,Count)
    Mp3Url = conn.get(Mp3JsonUrl, headers = headers)
    try :
        Mp3Url = json.loads(Mp3Url.text)['list'][0]['path']
        print('正在下载%s……'%Mp3Name)
        IdmDownLoad(Mp3Url,Mp3Name+'.mp3')
        time.sleep(2)
    except :
        print('%s,未购买,跳过……'%Mp3Name)


懒人听书下载嘤嘤嘤由于淘宝2块钱可以买到60听书券,针对此可重构代码:1.淘宝购买帐号密码后登陆懒人听书网页,自行购买书籍;2.设置完毕后运行,下载免费内容+该帐号已购买内容;3.若无已购买内容,仅下载该书籍免费部分;注:多帐号操作:某小说共有400集,其中1-200集为免费收听,300-400为付费章节。可操作方式:A帐号购买 200-300集,B帐号购买300-400集。将A帐号密码输入后运行,下载1-300集,然后切换为B帐号继续下载300-400集,会自动跳过已下载章节(基于已下载文件夹)。
说明逐个抓取懒人听书链接并直接下载,登录帐号密码后可下载已购买内容。需设置内容:书籍ID、帐号密码、文件下载路径、IDM路径、IDM下载时间间隔(time.sleep)。嗨学网嗨学网
源码下载:https://github.com/yoval/lrts 本帖被以下淘专辑推荐: · 实用工具|主题: 146, 订阅: 52

版权声明:

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

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

搜索