Skip to content

Instantly share code, notes, and snippets.

@yuzebin
yuzebin / open163_dl_single.sh
Created June 15, 2018 07:12
网易公开课单视频下载脚本
#!/usr/bin/env bash
# author: yuzebin AT gmail
# 20180614
# open163_dl_single.sh
main() {
curl -A "Mozilla/5.0 (iPad; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" $1 | grep -ohE "https?://[a-zA-Z0-9\.\/_&=@$?~#-]*" | grep m3u8 | xargs -I{} ffmpeg -i {} -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $2.mp4
}
if [[ $# -ne 2 ]]; then
@yuzebin
yuzebin / open163_dl.sh
Last active June 15, 2018 08:10
网易公开课下载脚本 open.163.com
#!/usr/bin/env bash
# author: yuzebin AT gmail
# 20180614
# open163_dl.sh
main() {
mkdir -p $2
cd $2
curl $1 | grep -e "http://open.163.com/movie/" | enca -L zh -x UTF-8 | sed -e "s/\<a href=\"//g" -e "s/\>//g" -e "s/<\/a//g" | grep -v class | sed -e "s/\ //g"> $2.lst
#include <QtGui/QApplication>
#include <QtGui/QPushButton>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPushButton *button = new QPushButton("Quit");
QObject::connect(button, SIGNAL(clicked()), &a, SLOT(quit()));
button->show();
return a.exec();
def read_file(fpath):
BLOCK_SIZE = 1024
with open(fpath, 'rb') as f:
while True:
block = f.read(BLOCK_SIZE)
if block:
yield block
else:
return