Skip to content

Instantly share code, notes, and snippets.

View cnbeining's full-sized avatar

David Zhuang cnbeining

View GitHub Profile
@cnbeining
cnbeining / get_click.py
Created November 2, 2015 01:44
Get bilibili click URL
#!/usr/bin/env python
#coding:utf-8
# Author: Beining --<i#cnbeining.com>
# Purpose: Get Bilibili click URL
# Created: 11/01/2015
#----------------------------------------------------------------------
def get_bilibili_click_url(aid = 0, mid = 0):
""""""
js_content = get_count_js(aid, mid)
@cnbeining
cnbeining / dilidili.py
Created October 26, 2015 05:05
For you-get, test only
#!/usr/bin/env python
__all__ = ['dilidili_download']
from ..common import *
#----------------------------------------------------------------------
def dilidili_parser_data_to_stream_types(typ ,vid ,hd2 ,sign):
"""->list"""
parse_url = 'http://player.005.tv/parse.php?xmlurl=null&type={typ}&vid={vid}&hd={hd2}&sign={sign}'.format(typ = typ, vid = vid, hd2 = hd2, sign = sign)
@cnbeining
cnbeining / live_number.py
Last active April 14, 2021 17:45
A simple script to get lots of viewers of Bilibili Live
#!/usr/bin/env python
#coding:utf-8
# Author: Beining --<cnbeining#gmail.com>
# Purpose: A simple script to get lots of viewers of Bilibili Live
# Created: 08/11/2015
# Error report: http://www.cnbeining.com/?p=952
# https://github.com/cnbeining somewhere within my gists
import sys
import time
@cnbeining
cnbeining / 163pp.py
Last active February 14, 2018 08:19
Batch download pp.163.com | 批量下载网易摄影 pp.163.com 的照片
#!/usr/bin/env python
#coding:utf-8
# Author: Beining http://www.cnbeining.com/ cnbeining[at]gmail.com
# Purpose: Batch download pp.163.com
# Created: 03/04/2015
# License: GNU GPL 2.0 https://www.gnu.org/licenses/gpl-2.0.html
import os
import sys
import unittest
@cnbeining
cnbeining / hostname.sh
Created January 31, 2015 22:12
Change hostname
#!/bin/bash
#Assign existing hostname to $hostn
hostn=$(cat /etc/hostname)
#Display existing hostname
echo "Existing hostname is $hostn"
#Ask for new hostname $newhost
echo "Enter new hostname: "
read newhost
@cnbeining
cnbeining / getvideosize.py
Created November 17, 2014 14:34
Get video size and duration
def getvideosize(url, verbose=False):
try:
if url.startswith('http:') or url.startswith('https:'):
ffprobe_command = ['ffprobe', '-icy', '0', '-loglevel', 'repeat+warning' if verbose else 'repeat+error', '-print_format', 'json', '-select_streams', 'v', '-show_streams', '-timeout', '60000000', '-user-agent', BILIGRAB_UA, url]
else:
ffprobe_command = ['ffprobe', '-loglevel', 'repeat+warning' if verbose else 'repeat+error', '-print_format', 'json', '-select_streams', 'v', '-show_streams', url]
logcommand(ffprobe_command)
ffprobe_process = subprocess.Popen(ffprobe_command, stdout=subprocess.PIPE)
try:
ffprobe_output = json.loads(ffprobe_process.communicate()[0].decode('utf-8', 'replace'))
@cnbeining
cnbeining / aes.sh
Created November 5, 2014 10:58
AES enc/dec
function enc() {
tar zcvf - $1 | openssl aes-256-cbc -salt -out $1.aes && srm -mfzr $1
}
function dec() {
openssl aes-256-cbc -d -in $1.aes | tar zxvf - && rm -f $1.aes
}
@cnbeining
cnbeining / upload_imgur.py
Last active August 29, 2015 14:06
Bash upload image to imgur
#Bash upload image to imgur
#Beining http://www.cnbeining.com/
#NEED requests !!!!!
import sys
import os
import glob
import requests
from base64 import b64encode
@cnbeining
cnbeining / yt.sh
Created August 20, 2014 18:20
ytdl: Quick download best DASH video and audio with Youtube and mux.
#!/bin/bash
#Youtube-DL DASH Video and Audio merging script
#Written by QuidsUp
#Edited by Christoph Korn
#Edited by Beining
File1New=video.m4v
File2New=audio.m4a
@cnbeining
cnbeining / Biligrab01.py
Created June 8, 2014 17:28
Biligrab 0.1
'''
Biligrab 0.1
Beining@ACICFG
http://www.cnbeining.com/
A most simple tool to download comments from Bilibili.
Require: Python 2.7
Usage:
python Biligrab01.py
>>>av12450
>>>p1