‘WebElement’ object has no attribute ‘sendKeys’

1.应广大市民反映,为减少人员集聚,自2020年2月24日(含)起,暂停“门店自取”口罩预约方式。

2.前期市民放弃预约各门店购买资格的口罩,将于2月23日在“门店自取”预约系统中全部投放,当天预约成功的市民可在2月25日(含)前到预约门店购买,逾期不再保留。

3.市民可继续通过“快递配送”方式自愿预约购买。自2月25日(含)起,“快递配送”预约系统开放时间,按照快递公司不同分为每天上午9:30和10:00两个时段。邮政、顺丰等量承担配送任务,市民可自行选择配送公司。

因为一个病毒导致很多事情都变的面目全非,口罩、消毒液都成了紧俏用品。为了能够买到口罩,就需要弥补手速过慢的问题。手速太慢了是抢不到口罩的,所以此时就需要自动提交数据。找到网址之后。很容易就可以定位到所有的输入框:

Continue Reading

Alec Radford’s animations for optimization algorithms[FW]

Alec Radford has created some great animations comparing optimization algorithms SGDMomentumNAGAdagradAdadeltaRMSprop (unfortunately no Adam) on low dimensional problems. Also check out his presentation on RNNs.

Noisy moons: This is logistic regression on noisy moons dataset from sklearn which shows the smoothing effects of momentum based techniques (which also results in over shooting and correction). The error surface is visualized as an average over the whole dataset empirically, but the trajectories show the dynamics of minibatches on noisy data. The bottom chart is an accuracy plot.”

Beale’s function: Due to the large initial gradient, velocity based techniques shoot off and bounce around – adagrad almost goes unstable for the same reason. Algos that scale gradients/step sizes like adadelta and RMSProp proceed more like accelerated SGD and handle large gradients with more stability.”

Continue Reading

m3u8 下载工具[Windows]

参数说明:

****************************************************************************************************
m3u8 downloader by obaby
m3u8_downloader -i <要下载的m3u8链接> -o <输出视频文件 .mp4> -p <输出目录>
Need Arguments(必选参数):
 -i < input m3u8 link >
Option Arguments(可选参数):
-o < output file > -p < out put path >
ffmpeg:F:\PyCharmProjects\m3u8_downloader\bin/ffmpeg.exe
Blog: http://www.h4ck.org.cn
Source Code: https://image.h4ck.org.cn/2020/01/基于ffmpeg的m3u8下载/
****************************************************************************************************

ps: 支持加密链接,其他系统请参考https://image.h4ck.org.cn/2020/01/基于ffmpeg的m3u8下载/

效果图:

Continue Reading

基于ffmpeg的m3u8下载[调整key替换逻辑,更新解析逻辑]

闲来没事,找了个av网站,看了几个视频,然后想下载一下。结果发现多年不上这些av网站,现在的av网站播放的源文件已经不是avi或者mp4了,而是m3u8的播放列表。在firefox中可以使用Video DownloadHelper 来获取相应的下载地址,但是有的时候如果m3u8中包含的是播放列表,会无法获取下载链接。

于是就想着怎么直接下载文件,其实通过ffmpeg可以很方便的获取下载链接:

只需要下面的一样命令:

 ffmpeg -protocol_whitelist "file,http,crypto,tcp,https,tls" -i https://videox11.ynkcq.com:8081/20200109/8Pr79HKk/600kb/hls/index.m3u8 -c copy out.mp4
Continue Reading

再谈《Django 限制访问频率》

之前提到使用ratelimit来限制访问频率,我的目的是根据用户来限制访问频率,但是实际上通过下面的代码并没有达到效果,如果用多个浏览器进行同时刷新,会存在跳过限制的情况

@ratelimit(key='user', rate='1/8s', block=True, method=('POST'))

本来是不想重复造轮子的,但是由于这个轮子不大好用,于是只好重新造一个,基于redis可以使用下面的代码来实现(ttl为限制时长):

def set_method_limit(method_name, player_id, ttl):
    cash_name = 'RATELIMIT::METHOD=' + method_name + 'PLAYERID=' + str(player_id)
    cache.set(cash_name, method_name, ttl)
def check_is_limit(method_name, player_id):
    cash_name = 'RATELIMIT::METHOD=' + method_name + 'PLAYERID=' + str(player_id)
    if cash_name in cache:
        return True
    return False
def redis_ratelimit(method='ALL', block=False, ttl=5):
    def decorator(fn):
        @wraps(fn)
        def _wrapped(*args, **kw):
            # Work as a CBV method decorator.
            request = args[0]
            auth = request.META.get('HTTP_AUTHORIZATION', 'UNKNOWN')
            # 获取用户id 如果失败则用token
            try:
                auth = request.user.id
                print('PID= ' + str(auth))
            except:
                pass
            token = str(auth).split(' ')[-1]
            if check_is_limit(method, token) and block:
                content = {
                    'status': 403,
                    'message': '大侠喝口茶,小女子给你讲个故事如何?\r\n 从前有座山,山上有座庙……',
                }
                return JsonResponse(content)
                # raise Redis_Rate_Limit()
            set_method_limit(method, token, ttl)
            return fn(*args, **kw)

        return _wrapped

    return decorator

使用方法和retalimit一致:

@api_view(['POST', 'GET'])
@redis_ratelimit(method='api_test', block=True, ttl=10)
@csrf_exempt
def api_test(request):
    """
    测试接口
    http://192.168.1.195:8006/rest-api/battle/api-test/


    :return: 普通数据测试
    """
    return json_response_message(status=API_SUCCESS, message=timezone.now().date())

redis 安装:

pip3 install django-redis
Continue Reading

ubuntu 18.04 pip3 install mysqlclient

不知道是阿里云的问题还是ubuntu本身的问题,今天安装mysqlclient提示:

/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

网上搜了一下没有发现类似的错误信息,于是转换思路直接搜索: /usr/bin/ld: cannot find -lssl 在这篇文章看到了解决方案:

https://blog.51cto.com/eminzhang/1285705

Continue Reading

Picasa3 DB Path Changer

用了多年不用的Delphi 写了个路径修改工具:

下载链接: 链接:https://pan.baidu.com/s/1Gztriz7sfpFSDghTyrX-Hw
提取码:hwvg

原理说明:https://image.h4ck.org.cn/2019/12/配置修改picasa3本地数据库路径/

Google 的免费图片管理工具Picasa,数秒钟内就可找到并欣赏计算机上的图片。 Picasa 原为独立收费的图像管理、处理软件,其界面美观华丽, 功能实用丰富。后来被 Google 收购并改为免费软件, 成为了 Google 的一部分,它最突出的优点是搜索硬盘中的相片图片的速度很快,当你输入一个字后,准备输入第二个字时,它已经即时显示出搜索出的图片。不管照片有多少,空间有多大,几秒内就可以查找到所需要的图片。
Picasa 是一款可帮助您在计算机上立即找到、修改和共享所有图片的软件。每次打开 Picasa 时,它都会自动查找所有图片(甚至是那些您已经遗忘的图片),并将它们按日期顺序放在可见的相册中,同时以您易于识别的名称命名文件夹。您可以通过拖放操作来排列相册,还可以添加标签来创建新组。Picasa 保证您的图片从始至终都井井有条。
Continue Reading