This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const request = require('superagent'); | |
const mkdirp = require('mkdirp'); | |
async function getMetas() { | |
const response = await request.get('https://www.bilibili.com/activity/web/view/data/31'); | |
const { body } = response; | |
if (body.code === 0) { | |
return body.data.list; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let passiveSupported = false; | |
try { | |
// platform that doesn't support `addEventListener` or `Object.defineProperty`, obviously doesn't support `passive`. | |
let options = Object.defineProperty({}, 'passive', { | |
get: function() { | |
passiveSupported = true; | |
} | |
}); | |
window.addEventListener('test-passive', null, options); | |
} catch (err) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// codes from https://github.com/madrobby/zepto/blob/601372ac4e3f98d502c707bf841589fbc48a3a7d/src/ajax.js#L344-L37 | |
// serialize the form data for `Content-Type: application/x-www-form-urlencoded` | |
// | |
// Usage Example: | |
// ```javascript | |
// const YOUR_DATA = {foo: "bar", some: "baz"} | |
// fetch('/api/result', { | |
// method: 'POST', | |
// headers: { | |
// 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define([], factory); | |
} else if (typeof module === 'object' && module.exports) { | |
module.exports = factory(); | |
} else { | |
root.Vector2 = factory(); | |
} | |
}(this, function () { | |
function Vector2(x,y){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import requests | |
import os | |
URL = 'http://www.bilibili.com/index/index-icon.json' | |
def get(): | |
resp = requests.get(URL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
from pyquery import PyQuery | |
from urllib2 import HTTPError | |
import os | |
class Picture(): | |
''' | |
Get picture(s) from image page. | |
@Note: HTML changed after login. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib,urllib2,json | |
import re | |
import os | |
import logging | |
from HTMLParser import HTMLParser | |
class HTMLStripper(HTMLParser): | |
''' | |
strip html tags | |
Solution from: http://stackoverflow.com/questions/753052/strip-html-from-strings-in-python#answer-925630 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import urllib,urllib2 | |
import time | |
import json | |
import os | |
import re | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import urllib,urllib2 | |
import json | |
import logging | |
class NeteaseMusicSigner(object): | |
''' | |
netease music signer | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define([], factory); | |
} else if (typeof exports === 'object') { | |
module.exports = factory(); | |
} else { | |
root['strHash'] = factory(); | |
} | |
}(this, function () { |
NewerOlder