GithubHelp home page GithubHelp logo

Comments (6)

yushiro avatar yushiro commented on May 27, 2024 1

基本找到临时解决方案了, 虽然修改了一下代码, 但目前的方案还不确定是否可以长期有效。
API请求带了w_rid这个散列值, 用的是MD5算法, 是把querystring排序后, 拼接上一个token, 然后MD5产生的。
token的生成算法也提取出来了, 但是有2个入参key还不确定是怎么来的, 虽然现在的b站并没有使用动态key, 每次发出来的请求, token都是一样的。
我使用一段时间再来回复这个方案是否可行。

from bilix.

yushiro avatar yushiro commented on May 27, 2024 1

感谢提醒,大致看了一下那个项目的代码,应该能够一劳永逸的解决这个问题,key是从另一个api接口获取的。
我照样子去修改一下。
btw:我不懂python,代码pr后,你可以自己看看怎么优化。
python代码都是让ai帮我从js转为py的

from bilix.

yushiro avatar yushiro commented on May 27, 2024

修改过的get_up_info方法, 只是加了2个warn输出

@raise_api_error
async def get_up_info(client: httpx.AsyncClient, url_or_mid: str, pn=1, ps=30, order='pubdate', keyword=''):
    """
    获取up主信息

    :param url_or_mid:
    :param pn:
    :param ps:
    :param order:
    :param keyword:
    :param client:
    :return:
    """
    if url_or_mid.startswith('http'):
        mid = re.findall(r'/(\d+)', url_or_mid)[0]
    else:
        mid = url_or_mid
    params = {'mid': mid, 'order': order, 'ps': ps, 'pn': pn, 'keyword': keyword}
    #日志输出params的内容
    logging.warn(f"参数,{params}")
    res = await req_retry(client, 'https://api.bilibili.com/x/space/wbi/arc/search', params=params)
    info = json.loads(res.text)
    logging.warn(f"返回值:{info}")
    up_name = info['data']['list']['vlist'][0]['author']
    total_size = info['data']['page']['count']
    bv_ids = [i['bvid'] for i in info['data']['list']['vlist']]
    return up_name, total_size, bv_ids

from bilix.

HFrost0 avatar HFrost0 commented on May 27, 2024

b站api有变动,等待后续修复

from bilix.

HFrost0 avatar HFrost0 commented on May 27, 2024

各位如果自己有能力调整的,也欢迎PR

from bilix.

HFrost0 avatar HFrost0 commented on May 27, 2024

@yushiro 我看到有开发者也解决了这个问题,如bilicope,如果稳定运行欢迎PR

from bilix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.