Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

域名又开始挂了,修改最新域名,并把可替换域名作为属性方便初始化后可自行修改 #68

Closed
wants to merge 5 commits into from

Conversation

wxh0402
Copy link

@wxh0402 wxh0402 commented Dec 2, 2021

No description provided.

@FSpark
Copy link

FSpark commented Dec 9, 2021

🎉👍 还有utils.pyis_file_urlis_folder_url的域名匹配也顺便改一下吧,只匹配[six]还不如以不变应万变😂

@zaxtyson
Copy link
Owner

了解

Comment on lines 102 to 105
def _all_possible_urls(self, url: str) -> List[str]:
"""蓝奏云的主域名有时会挂掉, 此时尝试切换到备用域名"""
available_domains = [
'lanzoui.com', # 鲁ICP备15001327号-6, 2020-06-09, SEO 排名最低
'lanzoux.com', # 鲁ICP备15001327号-5, 2020-06-09
'lanzous.com' # 主域名, 备案异常, 部分地区已经无法访问
return [
re.sub(r'lanzou\w\.com', d, url) for d in self.available_domains
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_all_possible_urls 需要微调下,改成先尝试原始链接,然后再生成其他备选的域名的链接。
主要作用是,极个别中间用到的中转文件链接只有在原始的链接的域名中有效,其他域名中会提示 分享已取消 ,比如下面这个地方的url

download_page = self._get(fake_url, allow_redirects=False)

修改后的参考代码

    def _all_possible_urls(self, url: str) -> List[str]:
        # 先把原始链接放到第一个
        urls = [url]

        # 然后再尝试其他的
        for d in self.available_domains:
            new_url = re.sub(r'lanzou\w\.com', d, url)
            if new_url not in urls:
                urls.append(new_url)

        return urls

zaxtyson added a commit that referenced this pull request Dec 30, 2021
zaxtyson added a commit that referenced this pull request Dec 30, 2021
@wxh0402 wxh0402 closed this Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants