Home >Backend Development >PHP Tutorial >php implements Douyu barrage, let's enjoy the barrage together~

php implements Douyu barrage, let's enjoy the barrage together~

藏色散人
藏色散人Original
2020-11-26 14:45:335292browse

Recommended: "PHP Video Tutorial"

Douyu Barrage PHP Version

github Address: https://github.com/wjhtime

I have written python before to get the barrage of Douyu Portal, I had a sudden idea and wanted to use php to fulfill. Obtaining the barrage is very simple to implement. It is easy to do it with swoole. In the later period, some optimization of the command line format was also done.

Used swoole to connect to the socket, which replaced the php socket function and is more convenient to use. Flexible, swoole document

The barrages of League of Legends are obtained by default. If you want to see the barrages of other rooms, just execute the command php cli.php danmu [room id]

Find a popular room and enjoy the barrage together!

Requirements

  • swoole extension

  • symfony/console

  • guzzlehttp/guzzle

  • jaeger/querylist

Quick Start

1. pecl install swoole

Omit the configuration process, refer to the swoole document for details...

2. git clone git@github.com:wjhtime/douyu_danmu_php.git

3. composer install -vvv (The installation process may be long, check the output through -vvv)

4. php cli.php douyu:search

5. php cli.php danmu

or php danmu.php

Feature

  • ##Use swoole to get barrage data

  • Using the symfony/console package, the content output is more beautiful

  • Message processing, barrage messages, gift giving, room sharing and other types are processed

Screenshots

php implements Douyu barrage, lets enjoy the barrage together~

##Illustrate

php implements Douyu barrage, lets enjoy the barrage together~

To Do List

The classification of barrage information is not clear enough and there are too many unknown types of data

The above is the detailed content of php implements Douyu barrage, let's enjoy the barrage together~. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn