Giter VIP home page Giter VIP logo

fuck-login's Introduction

Fuck Login !

GitHub stars GitHub forks GitHub issues GitHub license PyPI - Python Version Email

1.介绍

提供常见站点的模拟登陆

前言

由于原xchaoinfo/fuck-login的项目不再维护了,

所以利用业余时间参考xchaoinfo大神的代码重新做起一些常见站点的登录,希望一起交流学习。

登陆方式

  • 多数采用requests库创建会话session进行登陆
  • js加密会尽量转为Python实现,必要的js生成参数多采用PyExecJS,部分js代码过长会采用Selenium控制浏览器进行运行
  • 尽量不采用Selenium进行自动化操作登陆
  • 能力有限,水平一般。机器学习刚开始踩坑中,若登陆验证码的识别需要模型识别才能解决的话,暂时采用手动输入方案;若可通过OCR进行识别,会提提简单的处理思路。

2.程序结构

尽量每个登陆脚本采用相同的结构,希望能对执行流程的理解有所帮助。

import requests


class LoginWebsiteName:
    """登录程序结构"""
    
    # 登录操作会话对象
    session = requests.session()

    def __init__(self, username: str, password: str, **kwargs):
        self.username = username
        self.password = password
        pass

    def login(self) -> dict:
        """执行登录操作
        :return: `rtype:dict` 登录结果
        """
        pass

    def get_user_info(self) -> dict or None:
        """获取用户信息
        :return: 登录成功`rtype:dict`, 登录失败`rtype:None`
        """
        pass

    def get_login_cookies(self) -> dict:
        """获取用户登录后的cookies
        :return:
        """
        pass


if __name__ == '__main__':
    test_name = 'your username'
    test_password = 'your password'
    loginer = LoginWebsiteName(username=test_name, password=test_password)
    # 开始执行登录操作
    login_result = loginer.login()
    # 获取用户信息
    user_info = loginer.get_user_info()
    # 获取登录状态cookies
    cookies = loginer.get_login_cookies()

3. 已完成站点

关于每个站点的实现方式,我会在这个文档README-IDEAs.md中描述一下简单的思路。

  • 新浪微博
  • 今日头条
  • 搜狐新闻
  • 凤凰新闻
  • 豆瓣
  • 触电新闻媒体平台
  • GitHub
  • 中关村在线

4.写在最后

  • 脚本还在逐渐完善添加中,欢迎大家提Issues,顺便再给个Star吧;
  • 如果你觉得某个网站的登录很有代表性,欢迎在 Issues 中提出,我会尽量在之后的实现脚本中加入。

fuck-login's People

Contributors

imleowoo avatar

Watchers

James Cloos avatar

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.