当前位置:首页 > 代码·功能 > 正文

无聊弄的简易自动领B站小电视php脚本

破站今天又改版了pc端的api真的难受,拿手机重新抓了一遍包,修了修然后正好无聊突然想起来之前在群里说弄个简易的抢电视脚本自己抢

想了想似乎懒癌发作想弄什么什么都没弄,既然正好吃完饭有点时间就拿手机蛋疼的写了这么个脚本

因为礼物信息需要socket监控弹幕,普通fpm运行下的php是肯定搞不定的,这个脚本是直接抓取我直播间的弹幕查看是否有礼物需要领取

输入自己的cookie直接监控php脚本就可以了,想多快就自己决定了,不过一定不要太...长了

直接丢代码

<?php
/*
Name:简易B站领小电视脚本
Design:小幻酱吖
*/
$cookie = '输入你的帐号cookie';
function curl($url, $cookie = null, $refer = null) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $refer);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 BIDUBrowser/8.3 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 6);
$re = curl_exec($ch);
curl_close($ch);
return $re;
}
$msglist = json_decode(curl('http://api.live.bilibili.com/AppRoom/msg?room_id=2026835'),true);
$msg = $msglist['data']['room'][9]['text'];
$time = $msglist['data']['room'][9]['timeline'];
$id = md5($msg.$time);
$log = file_get_content('log.db');
if(strpos($log,$id)){
    exit('没有需要抢的');
}
$id);
if(strpos($msg,'小电视')){
file_put_content('log.db',$log.PHP_EOL.
$roomid = str_replace('小电视X1','',$msg);
$raffleId = json_decode(curl('http://api.live.bilibili.com/gift/v2/smalltv/check?roomid='.$roomid),true);//5.6以下PHP版本问题麻烦一点咯
foreach($raffleId['data'] as $data){
$raffle = $data['raffleId'];
echo curl('http://api.live.bilibili.com/gift/v2/smalltv/join?roomid='.$roomid.'&raffleId='.$raffle,$cookie,'http://live.bilibili.com/'.$roomid);
}
}

手机写的不咋地,大佬勿喷~~

需要有本地读写权利,不然无限领来领去就不好玩了。

好了好了,水完一波就可以撤了

标签:
上一篇:

506 条评论

评论加载中...
  1. I’m ѕtilⅼ learning fгom you, wһile I’m mɑking mү way to the
    top аѕ well. Ι cеrtainly enjoy reading аll that is posted on yߋur blog.Keеp tһe stories
    coming. I loved it!

    2018年6月22日 04:05 评论
  2. I have been surfing online more than 4 hours today, yet I
    never found any interesting article like yours. It is pretty worth enough for me.
    In my opinion, if all web owners and bloggers made good content as you did,
    the net will be a lot more useful than ever before.|
    I couldn’t refrain from commenting. Perfectly written!|
    I’ll right away take hold of your rss as I can not
    in finding your e-mail subscription link or newsletter service.
    Do you’ve any? Please permit me recognize so that I may subscribe.
    Thanks.|
    It’s appropriate time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I wish to suggest you some interesting things or tips.

    Perhaps you could write next articles referring
    to this article. I wish to read more things about it!|
    It is the best time to make a few plans for the longer
    term and it is time to be happy. I have learn this put up
    and if I may I wish to counsel you few interesting issues or advice.
    Maybe you can write next articles regarding this article.
    I wish to learn more issues approximately it!|
    I’ve been surfing on-line more than three hours nowadays, but I by no means discovered any interesting article like yours.
    It is pretty price sufficient for me. In my view, if
    all website owners and bloggers made excellent content material as you did, the
    internet might be a lot more useful than ever before.|
    Ahaa, its good discussion regarding this paragraph at this place at this blog, I have
    read all that, so now me also commenting at this place.|
    I am sure this article has touched all the internet visitors, its really really fastidious post on building up new web site.|
    Wow, this paragraph is nice, my sister is analyzing such things, thus I am going to inform her.|
    Saved as a favorite, I really like your website!|
    Way cool! Some extremely valid points! I appreciate you
    penning this article and the rest of the site is really good.|
    Hi, I do think this is an excellent blog. I stumbledupon it ;) I’m going to revisit once again since i have book marked it.
    Money and freedom is the greatest way to change, may you be rich and
    continue to guide others.|
    Woah! I’m really loving the template/theme of this website.
    It’s simple, yet effective. A lot of times
    it’s difficult to get that “perfect balance” between user friendliness and visual appearance.

    I must say you have done a very good job with this.
    Also, the blog loads super quick for me on Safari. Superb
    Blog!|
    These are actually great ideas in on the topic of blogging.
    You have touched some nice factors here. Any way keep up wrinting.|
    I really like what you guys are usually up too. This kind of clever
    work and coverage! Keep up the amazing works guys I’ve included you
    guys to our blogroll.|
    Hey! Someone in my Myspace group shared this site with us so I came
    to give it a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this
    to my followers! Wonderful blog and amazing design.|
    I enjoy what you guys are up too. Such clever work and
    exposure! Keep up the terrific works guys I’ve included you guys to
    our blogroll.|
    Howdy would you mind sharing which blog platform you’re working with?
    I’m planning to start my own blog soon but I’m having a tough
    time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs and I’m looking for something unique.
    P.S Sorry for being off-topic but I had to ask!|
    Hey there would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 completely different browsers
    and I must say this blog loads a lot quicker then most.
    Can you recommend a good hosting provider at a fair
    price? Many thanks, I appreciate it!|
    I like it whenever people come together and share ideas.

    Great site, continue the good work!|
    Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to far added agreeable from you! However, how could we communicate?|
    Hey there just wanted to give you a quick heads up. The words in your content
    seem to be running off the screen in Ie. I’m not sure if this is a formatting
    issue or something to do with browser compatibility but I thought
    I’d post to let you know. The design look great though!
    Hope you get the issue fixed soon. Cheers|
    This is a topic which is near to my heart… Cheers!
    Exactly where are your contact details though?|
    It’s very trouble-free to find out any matter on net as compared to
    books, as I found this piece of writing at this web page.|
    Does your site have a contact page? I’m having problems locating it but,
    I’d like to send you an e-mail. I’ve got some suggestions for your blog you might be interested in hearing.
    Either way, great site and I look forward to seeing it develop over time.|
    Hola! I’ve been following your blog for a long time now and finally got the bravery to go ahead and
    give you a shout out from Porter Texas! Just wanted to tell you keep up the fantastic job!|
    Greetings from Carolina! I’m bored to death at work so I decided to check out your blog on my iphone during
    lunch break. I enjoy the knowledge you provide here and can’t wait to take a look when I get home.
    I’m surprised at how fast your blog loaded on my cell phone ..

    I’m not even using WIFI, just 3G .. Anyhow, awesome blog!|
    Its like you read my mind! You seem to understand a lot about this, such as you
    wrote the e book in it or something. I think that you can do with
    some % to pressure the message house a bit, but other than that,
    that is magnificent blog. A fantastic read. I will definitely be back.|
    I visited many sites except the audio quality for audio songs existing at this site is actually excellent.|
    Hi there, i read your blog from time to time and i own a similar one and i was
    just wondering if you get a lot of spam feedback? If so how do you stop it, any plugin or anything
    you can recommend? I get so much lately it’s driving me crazy so any support is very much appreciated.|
    Greetings! Very useful advice within this post! It is the little changes that produce the largest changes.
    Thanks for sharing!|
    I seriously love your blog.. Pleasant colors & theme. Did you create this web
    site yourself? Please reply back as I’m trying
    to create my own site and want to know where you got this from
    or exactly what the theme is called. Thank you!|
    Hi there! This post couldn’t be written much better!
    Looking at this post reminds me of my previous roommate!

    He continually kept talking about this. I’ll forward this article to him.
    Pretty sure he’ll have a very good read. I appreciate you for sharing!|
    Whoa! This blog looks exactly like my old one! It’s on a completely different subject but it has pretty much
    the same layout and design. Wonderful choice of colors!|
    There is definately a great deal to find out about this subject.
    I like all the points you made.|
    You made some decent points there. I checked on the net for more information about the issue and found most people will
    go along with your views on this site.|
    Hello, I read your blog like every week. Your writing style
    is witty, keep it up!|
    I simply couldn’t depart your website before suggesting that I actually loved the usual information an individual provide to your visitors?
    Is going to be again often in order to check out new posts|
    I want to to thank you for this excellent read!! I absolutely loved every little bit of it.
    I’ve got you book marked to look at new stuff you post…|
    Hi, just wanted to tell you, I enjoyed this blog post.
    It was helpful. Keep on posting!|
    Hi there, I enjoy reading all of your article post. I like to write a little comment to support you.|
    I always spent my half an hour to read this weblog’s articles every day
    along with a mug of coffee.|
    I always emailed this web site post page to all my friends, because if like to read it
    then my contacts will too.|
    My coder is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress on a
    variety of websites for about a year and am anxious
    about switching to another platform. I have heard good things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?
    Any kind of help would be greatly appreciated!|
    Hi there! I could have sworn I’ve visited this web site before but after looking
    at some of the articles I realized it’s new to me. Anyhow, I’m certainly happy I stumbled upon it and I’ll be book-marking
    it and checking back frequently!|
    Terrific article! This is the type of information that
    are meant to be shared across the net. Shame on the search
    engines for not positioning this submit upper! Come on over
    and talk over with my site . Thank you =)|
    Heya i’m for the first time here. I came across this board and I find It really useful & it helped me out a lot.
    I hope to give something back and help others like you helped me.|
    Hello, I believe your site may be having browser compatibility problems.

    When I look at your site in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping issues.
    I merely wanted to provide you with a quick heads up! Besides that, fantastic site!|
    A person essentially help to make critically articles I would state.
    This is the very first time I frequented your web
    page and so far? I surprised with the analysis you made to
    make this actual publish extraordinary. Magnificent process!|
    Heya i am for the primary time here. I found this board
    and I in finding It really helpful & it helped
    me out a lot. I hope to provide something back and aid others like you helped me.|
    Hey there! I simply wish to offer you a big thumbs up for your great information you have here on this post.
    I’ll be returning to your web site for more soon.|
    I every time used to read piece of writing in news papers but
    now as I am a user of net so from now I am using net for articles or reviews, thanks to
    web.|
    Your method of describing all in this post is in fact
    pleasant, every one be able to simply know it, Thanks a lot.|
    Hi there, I discovered your website by the use of Google at the same
    time as searching for a comparable matter, your website got here up,
    it appears to be like good. I’ve bookmarked it in my google bookmarks.

    Hi there, simply changed into aware of your weblog thru Google, and located that it is really informative.

    I am gonna be careful for brussels. I’ll be grateful in case you proceed this in future.
    Many folks can be benefited from your writing.
    Cheers!|
    I am curious to find out what blog platform you’re utilizing?
    I’m having some small security issues with my latest website and I’d like to find something more
    secure. Do you have any solutions?|
    I am extremely impressed with your writing skills and also with the layout on your blog.
    Is this a paid theme or did you modify it yourself? Either
    way keep up the excellent quality writing, it is rare to see a nice
    blog like this one these days.|
    I am extremely inspired along with your writing talents as well
    as with the layout for your blog. Is this a paid theme or
    did you customize it your self? Anyway keep up the nice high quality writing, it’s
    rare to peer a nice weblog like this one these days..|
    Hi, Neat post. There is an issue along with your website in web explorer, would check this?
    IE still is the marketplace leader and a big element of other folks will pass over your wonderful writing because of this problem.|
    I am not sure where you’re getting your information, but good topic.
    I needs to spend some time learning more or understanding more.
    Thanks for wonderful information I was looking for this info for my mission.|
    Hi, i think that i saw you visited my website thus i
    came to “return the favor”.I’m trying to find things to enhance my website!I suppose
    its ok to use a few of \

    2018年6月19日 17:16 评论
  3. 8楼
    来自天朝的朋友 谷歌浏览器 Windows 10
    子午  

    CDN在同IP的路过。。。。。

    2018年6月8日 12:41 评论
  4. 这个好,还能用不?

    2018年6月1日 15:58 评论
  5. 6楼
    来自天朝的朋友 QQ浏览器 Windows 10
    小幻忠实粉丝  

    小幻可以给个邀请码吗?

    2018年4月16日 14:45 评论
  6. 5楼
    来自天朝的朋友 谷歌浏览器 Windows 7
      

    【暴力项目】无需引流,日赚500+,当天收款,人人可操作

    1、首先这个项目当然是可以长期做的,不是做几天就死的短期项目!
    2、项目操作简单,一学就会,人人可以操作!
    3、操作本项目需要投资100元以下,什么0投资也能赚钱的你相信吗?
    4、项目是大众项目,上万人同时操作无半点影响!
    5、完全的正规合法,阳光项目,并且是真正的长期可一直操作的项目!
    6、我不是雷锋,你赚钱了给我分20%的利润,不会分钱是不会永久带你的。

    同意以上观点:
    加微信ZH042088 (验证码a010) 会马上通过好友请求

    2018年3月15日 14:08 评论
  7. 手机敲得这段代码?厉害了我的哥。

    2018年3月15日 12:55 评论
  8. 地板
    这家伙可能用了美佬的代理 谷歌浏览器 Windows 7
    疯狂  

    老大厉害!

    2018年3月12日 02:14 评论
  9. 板凳
    来自天朝的朋友 谷歌浏览器  MZ63 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.53 Safari/537.36
    狂放  

    大佬用手机写代码什么感觉,我说发疯的感觉

    2018年3月11日 10:58 评论
  10. 更新得好速度,厉害了

    2018年3月9日 00:25 评论

发表评论

不理你。不要啊!吃饭。吃惊。吃西瓜。飞吻!恭喜!Hi纠结!膜拜!OK抛媚眼。泡泡糖。抛钱。忍!生闷气!调皮。偷看。委屈。献花。疑问?抓狂!

小提示:Ctrl+Enter快速提交助您一臂之力~
加载中……