Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@直播央视网@eyJmaXJzdEhlYWRlciI6ImNsYXNzIiwibGFzdF9jaGFwdGVyX3J1bGUiOiIiLCJ0aXRsZSI6IuebtOaSreWkruinhue9kSIsImF1dGhvciI6Inh4cyIsInVybCI6Imh0dHBzOi8vbmV3cy5jY3R2LmNvbS8yMDE5LzA3L2dhaWJhbi9jbXNkYXRhaW50ZXJmYWNlL3BhZ2UvZnljbGFzc19meXBhZ2UuanNvbnA/Y2I9ZnljbGFzcyIsInZlcnNpb24iOjMsImNvbF90eXBlIjoibW92aWVfMV9sZWZ0X3BpYyIsImNsYXNzX25hbWUiOiLmlrDpl7sm5Zu95YaFJuWbvemZhSbnlJ/mtLsm56S+5LyaJuenkeaKgCbms5Xmsrsm5paH5aixJuaVmeiCsiblgaXlurcm57uP5rWOIiwidHlwZSI6Im5ld3MiLCJjbGFzc191cmwiOiJuZXdzJmNoaW5hJndvcmxkJmxpZmUmc29jaWV0eSZ0ZWNoJmxhdyZlbnQmZWR1JmhlYWx0aCZlY29ub215IiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6XG52YXIgcmVzID0ge307XG52YXIgZCA9IFtdO1xuZXZhbChKU09OLnBhcnNlKHJlcXVlc3QoXCJoaWtlcjovL3BhZ2UvdXNlc1wiKSkucnVsZSk7XG52YXIgaHRtbD1nZXRSZXNDb2RlKCk7XG5cblxuLy92YXIganNvbiA9IEpTT04uc3RyaW5naWZ5KCk7XG4vL3ZhciBqcyA9IEpTT04uc3RyaW5naWZ5KGpzb24pO1xudmFyIGpzYiA9IGh0bWwuc3Vic3RyaW5nKGh0bWwuaW5kZXhPZihcIihcIikgKyAxLCBodG1sLmxhc3RJbmRle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yxcXG4gICAgICAgIGRfZGF5cyxcXG4gICAgICAgIHRpbWVOb3cgPSBwYXJzZUludChuZXcgRGF0ZSgpLmdldFRpbWUoKSAvIDEwMDApLFxcbiAgICAgICAgZCxcXG4gXFxuICAgICAgICBkYXRlID0gbmV3IERhdGUocHVibGlzaFRpbWUgKiAxMDAwKSxcXG4gICAgICAgIFkgPSBkYXRlLmdldEZ1bGxZZWFyKCksXFxuICAgICAgICBNID0gZGF0ZS5nZXRNb250aCgpICsgMSxcXG4gICAgICAgIEQgPSBkYXRlLmdldERhdGUoKSxcXG4gICAgICAgIEggPSBkYXRlLmdldEhvdXJzKCksXFxuICAgICAgICBtID0gZGF0ZS5nZXRNaW51dGVzKCksXFxuICAgICAgICBzID0gZGF0ZS5nZXRTZWNvbmRzKCk7XFxuICAgICAgICAvL+Wwj+S6jjEw55qE5Zyo5YmN6Z2i6KGlMFxcbiAgICAgICAgaWYgKE0gPCAxMCkge1xcbiAgICAgICAgICAgICAgICBNID0gJzAnICsgTTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChEIDwgMTApIHtcXG4gICAgICAgICAgICAgICAgRCA9ICcwJyArIEQ7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoSCA8IDEwKSB7XFxuICAgICAgICAgICAgICAgIEggPSAnMCcgKyBIO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKG0gPCAxMCkge1xcbiAgICAgICAgICAgICAgICBtID0gJzAnICsgbTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChzIDwgMTApIHtcXG4gICAgICAgICAgICAgICAgcyA9ICcwJyArIHM7XFxuICAgICAgICB9XFxuIFxcbiAgICAgICAgZCA9IHRpbWVOb3cgLSBwdWJsaXNoVGltZTtcXG4gICAgICAgIGRfZGF5cyA9IHBhcnNlSW50KGQgLyA4NjQwMCk7XFxuICAgICAgICBkX2hvdXJzID0gcGFyc2VJbnQoZCAvIDM2MDApO1xcbiAgICAgICAgZF9taW51dGVzID0gcGFyc2VJbnQoZCAvIDYwKTtcXG4gICAgICAgIGRfc2Vjb25kcyA9IHBhcnNlSW50KGQpO1xcbiBcXG4gICAgICAgIGlmIChkX2RheXMgPiAwICYmIGRfZGF5cyA8IDMpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGRfZGF5cyArICflpKnliY0nO1xcbiAgICAgICAgfSBlbHNlIGlmIChkX2RheXMgPD0gMCAmJiBkX2hvdXJzID4gMCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gZF9ob3VycyArICflsI/ml7bliY0nO1xcbiAgICAgICAgfSBlbHNlIGlmIChkX2hvdXJzIDw9IDAgJiYgZF9taW51dGVzID4gMCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gZF9taW51dGVzICsgJ+WIhumSn+WJjSc7XFxuICAgICAgICB9IGVsc2UgaWYgKGRfc2Vjb25kcyA8IDYwKSB7XFxuICAgICAgICAgICAgICAgIGlmIChkX3NlY29uZHMgPD0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAn5Yia5YiaJztcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZF9zZWNvbmRzICsgJ+enkuWJjSc7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSBpZiAoZF9kYXlzID49IDMgJiYgZF9kYXlzIDwgMzApIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIE0gKyAnLScgKyBEICsgJyAnICsgSCArICc6JyArIG07XFxuICAgICAgICB9IGVsc2UgaWYgKGRfZGF5cyA+PSAzMCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gWSArICctJyArIE0gKyAnLScgKyBEICsgJyAnICsgSCArICc6JyArIG07XFxuICAgICAgICB9XFxufVxcbiBcXG5mdW5jdGlvbiBnZXREYXRlVGltZVN0YW1wKGRhdGVTdHIpIHtcXG4gICAgICAgICAgLy8g5aaC5p6c5pe26Ze05qC85byP5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bmN0aW9uIGdldEF1dGhvclRleHQodGV4dCkge1xcbiAgICByZXR1cm4gZ2V0Q29sb3JUZXh0KHRleHQsIHVzZXJDb2xvcik7XFxufVxcbmZ1bmN0aW9uIGdldENvZGVUZXh0KHRleHQpIHtcXG4gICAgcmV0dXJuICc8Y29kZT4nICsgdGV4dCArICc8L2NvZGU+JztcXG59XFxuZnVuY3Rpb24gZ2V0QmxvY2txdW90ZVRleHQodGV4dCkge1xcbiAgICByZXR1cm4gJzxibG9ja3F1b3RlPicgKyB0ZXh0ICsgJzwvYmxvY2txdW90ZT4nXFxufVxcbmZ1bmN0aW9uIGdldEFkZHJlc3NUYWcodXJsLCB0ZXh0KSB7XFxuICAgIHJldHVybiAnPGEgaHJlZj1cXFwiJyArIHVybCArICdcXFwiPicgKyB0ZXh0ICsgJzwvYT4nXFxufVxcbmZ1bmN0aW9uIGdldENvbW1lbnRNZXRhKGh0bWwpIHtcXG4gICAgcmV0dXJuIGdldFNtYWxsVGV4dChodG1sKTtcXG59XCJ9XSIsImljb24iOiJodHRwczovL3A1LmltZy5jY3R2cGljLmNvbS9waG90b0FsYnVtL3RlbXBsZXQvY29tbW9uL0RFUEExNjA0MzY3NDkwNDA5NjQ0L2xvZ29uZXcxOTAyMTguanBnIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment