Skip to content

Commit 17d11f9

Browse files
committed
一起看
1 parent a0dae88 commit 17d11f9

40 files changed

+1755
-952
lines changed

.idea/workspace.xml

Lines changed: 256 additions & 839 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
## 功能特性
1717

18+
+ 一起在线连麦观看(和朋友一起观看精彩影视)
1819
+ 免VIP在线观看影视(资源来源网络)
1920
+ 观看看影视的同时能发送弹幕
2021
+ 跨平台同步观看历史记录
@@ -32,6 +33,10 @@
3233

3334
## 版本内容更新
3435

36+
### 2020-3-20
37+
38+
增加一起看功能
39+
3540
### 2019-10-20
3641

3742
+ 弹幕获取功能,不用担心一个人看没弹幕啦,在一些人气较高的影视会自动获取弹幕

pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@
8787
<groupId>org.springframework.boot</groupId>
8888
<artifactId>spring-boot-starter-websocket</artifactId>
8989
</dependency>
90+
<dependency>
91+
<groupId>commons-codec</groupId>
92+
<artifactId>commons-codec</artifactId>
93+
<version>1.11</version>
94+
</dependency>
9095
</dependencies>
9196
<build>
9297
<plugins>
@@ -96,12 +101,6 @@
96101
<configuration>
97102
<mainClass>com.danbai.ys.YsApplication</mainClass>
98103
<layout>ZIP</layout>
99-
<includes>
100-
<include>
101-
<groupId>nothing</groupId>
102-
<artifactId>nothing</artifactId>
103-
</include>
104-
</includes>
105104
</configuration>
106105
<executions>
107106
<execution>

py/tagpa.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import json
1+
import json
22
import random
33
import requests
44
from lxml import etree
@@ -19,49 +19,51 @@
1919
setsession=[], # 开始会话前执行的命令列表。如:["set datestyle to ...", "set time zone ..."]
2020
ping=0,
2121
# ping MySQL服务端,检查是否服务可用。# 如:0 = None = never, 1 = default = whenever it is requested, 2 = when a cursor is created, 4 = when a query is executed, 7 = always
22-
host='127.0.0.1',
22+
host='185.207.153.189',
2323
port=3306,
2424
user='ys',
25-
password='password',
25+
password='hjj225',
2626
database='ys',
2727
charset='utf8'
2828
)
2929
proxys=[]
3030
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'}
3131
#获取代理
32-
def get_proxy():
32+
def get_proxy(i):
3333
global proxys
34-
r=requests.get("http://ip.jiangxianli.com/")
35-
if(r.status_code==200):
36-
selector=etree.HTML(r.text)
37-
proxys=proxys+selector.xpath('//button[@class="layui-btn layui-btn-sm btn-copy"]/@data-url')
34+
for num in range(0,i):
35+
r=requests.get("http://api.p00q.cn/proxy/get")
36+
if(r.status_code==200):
37+
rjson = r.text
38+
rjsonp = json.loads(rjson)
39+
dl=rjsonp.get('ip')+":"+rjsonp.get("port")
40+
proxys.append(dl)
3841
#获取页面html
3942
def getHtml(url,p):
4043
if p:
4144
global proxys
42-
p=proxys[random.randint(0,len(proxys)-1)]
4345
try:
44-
pp=p.replace("http://","")
45-
pp=pp.replace("https://","")
46-
html = requests.get(url,proxies={"http":pp},headers=header,timeout=5)
46+
i=random.randint(0,len(proxys)-1)
47+
html = requests.get(url,proxies={'http':proxys[i]},headers=header,timeout=5)
4748
if html!=None:
4849
return html.text
4950
except Exception:
50-
proxys.remove(p)
51-
if len(proxys)<2:
52-
get_proxy()
51+
proxys.remove(proxys[i])
52+
if len(proxys)<5:
53+
get_proxy(10)
5354
return getHtml(url,True)
5455
else :
5556
html = requests.get(url,headers=header,timeout=5)
5657
return html.text
5758
def main():
5859
global proxys
59-
get_proxy()
60+
get_proxy(10)
61+
print(proxys)
6062
conn = POOL.connection()
6163
cursor = conn.cursor()
62-
cursor.execute("SELECT id,pm,dy,lx,gkdz,xzdz FROM `ysb` ORDER BY `gxtime` DESC LIMIT 60")
64+
cursor.execute("SELECT id,pm,dy,lx,gkdz,xzdz FROM `ysb` ORDER BY `gxtime` DESC LIMIT 1000")
6365
data = cursor.fetchall()
64-
rpool = redis.ConnectionPool(host='127.0.0.1', port=6379,db=0)
66+
rpool = redis.ConnectionPool(host='185.207.153.189', port=6379,db=0,password='danbairedis225')
6567
pool = ThreadPool(30)
6668
for ys in data:
6769
try:
@@ -84,15 +86,15 @@ def run(ys,r):
8486
else:
8587
tnum=int(tnum)
8688
if tnum<len(jys):
87-
fh=getHtml("http://v.qq.com/x/search/?q="+pm,False)
89+
fh=getHtml("http://v.qq.com/x/search/?q="+pm,True)
8890
ysid=re.compile("{id: '(.*)'; type: '2';}",re.M).findall(fh)[0]
8991
fh=getHtml("http://s.video.qq.com/get_playsource?plat=2&type=4&range=1&otype=json&id="+ysid,True)
9092
jsonj=json.loads(fh[13:-1])
9193
jlist=jsonj["PlaylistItem"]["videoPlayList"]
9294
taglist=[]
9395
if jsonj["PlaylistItem"]['payType']==2:
9496
for i in range (0,len(jlist)):
95-
tfh=getHtml("http://bullet.video.qq.com/fcgi-bin/target/regist?otype=json&vid="+jlist[i]['id'],False)
97+
tfh=getHtml("http://bullet.video.qq.com/fcgi-bin/target/regist?otype=json&vid="+jlist[i]['id'],True)
9698
tagid=json.loads(tfh[13:-1])['targetid']
9799
taglist.append(tagid)
98100
taglist.reverse()
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @author DanBai
3+
* @create 2020-03-17 16:29
4+
* @desc yb
5+
**/
6+
package com.danbai.ys.async;
7+
8+
import com.danbai.ys.websocket.CinemaSocket;
9+
import org.springframework.scheduling.annotation.Async;
10+
import org.springframework.stereotype.Component;
11+
12+
@Component
13+
public class CinemaSocketAsync {
14+
@Async
15+
public void sendRoomMsg(int id,String msg){
16+
CinemaSocket.ROOM_POOL.get(id).getSockets().forEach(sid->{
17+
CinemaSocket.POOL.get(sid).sendMessage(msg);
18+
});
19+
}
20+
@Async
21+
public void sendRoomMsgPassAuthor(int id,String msg){
22+
String authorId = CinemaSocket.ROOM_POOL.get(id).getAuthorId();
23+
CinemaSocket.ROOM_POOL.get(id).getSockets().forEach(sid->{
24+
if(!sid.equals(authorId)){
25+
CinemaSocket.POOL.get(sid).sendMessage(msg);
26+
}
27+
});
28+
}
29+
}

src/main/java/com/danbai/ys/config/RedisConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connec
5454

5555
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
5656
Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer(Object.class);
57-
5857
ObjectMapper mapper = new ObjectMapper();
5958
mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
6059
mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);

src/main/java/com/danbai/ys/controller/MainController.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public class MainController {
3333
AdminServiceImpl adminService;
3434
@Autowired
3535
CommImpl comm;
36-
@Autowired
37-
SiteMapUtils siteMapUtils;
3836
@ModelAttribute
3937
public void bif(Model model) {
4038
model.addAllAttributes(comm.getAllComm());
@@ -124,6 +122,7 @@ String loginApi(User user, HttpServletRequest request, HttpServletResponse respo
124122
return "login";
125123
}
126124

125+
127126
@RequestMapping(value = "/loginapp", produces = "text/plain;charset=UTF-8", method = RequestMethod.POST)
128127
@ResponseBody
129128
String loginAppApi(User user, HttpServletRequest request, HttpServletResponse response) {
@@ -175,9 +174,12 @@ String person(HttpServletRequest request, Model model) {
175174
model.addAttribute("gkls", gkls);
176175
return "person";
177176
}
178-
@GetMapping(value = "/sitemap.xml",produces = {"application/xml"})
179-
@ResponseBody
180-
public String getSiteMap() {
181-
return siteMapUtils.getSiteMap();
177+
@RequestMapping(value = "/yiqikan", produces = "text/plain;charset=UTF-8", method = RequestMethod.GET)
178+
String yiQiKan(HttpServletRequest request) {
179+
180+
if(request.getSession().getAttribute("user")==null){
181+
return "redirect:/login";
182+
}
183+
return "yiqikan/index";
182184
}
183185
}

src/main/java/com/danbai/ys/controller/UtilsController.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package com.danbai.ys.controller;
22

33
import com.danbai.ys.service.impl.RegisterValidateServiceImpl;
4+
import com.danbai.ys.utils.SiteMapUtils;
45
import org.springframework.beans.factory.annotation.Autowired;
56
import org.springframework.stereotype.Controller;
7+
import org.springframework.web.bind.annotation.GetMapping;
68
import org.springframework.web.bind.annotation.RequestMapping;
79
import org.springframework.web.bind.annotation.RequestMethod;
810
import org.springframework.web.bind.annotation.ResponseBody;
@@ -15,7 +17,8 @@
1517
public class UtilsController {
1618
@Autowired
1719
RegisterValidateServiceImpl registerValidateService;
18-
20+
@Autowired
21+
SiteMapUtils siteMapUtils;
1922
@RequestMapping(value = "/getvalidate", produces = "text/plain;charset=UTF-8", method = RequestMethod.GET)
2023
@ResponseBody
2124
public String getValidate(String username, String email) {
@@ -25,4 +28,9 @@ public String getValidate(String username, String email) {
2528
registerValidateService.senValidate(email);
2629
return "ok";
2730
}
31+
@GetMapping(value = "/sitemap.xml",produces = {"application/xml"})
32+
@ResponseBody
33+
public String getSiteMap() {
34+
return siteMapUtils.getSiteMap();
35+
}
2836
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* @author DanBai
3+
* @create 2020-03-10 23:57
4+
* @desc 影院room
5+
**/
6+
package com.danbai.ys.entity;
7+
8+
import java.io.Serializable;
9+
import java.util.concurrent.CopyOnWriteArraySet;
10+
11+
public class CinemaRoom implements Serializable {
12+
private int id;
13+
private String name;
14+
private CopyOnWriteArraySet<String> sockets;
15+
private String pass;
16+
private String authorId;
17+
private String url;
18+
private double time;
19+
public int getId() {
20+
return id;
21+
}
22+
23+
public void setId(int id) {
24+
this.id = id;
25+
}
26+
27+
public String getName() {
28+
return name;
29+
}
30+
31+
public void setName(String name) {
32+
this.name = name;
33+
}
34+
35+
public CopyOnWriteArraySet<String> getSockets() {
36+
return sockets;
37+
}
38+
39+
public void setSockets(CopyOnWriteArraySet<String> sockets) {
40+
this.sockets = sockets;
41+
}
42+
43+
public String getPass() {
44+
return pass;
45+
}
46+
47+
public void setPass(String pass) {
48+
this.pass = pass;
49+
}
50+
51+
public String getAuthorId() {
52+
return authorId;
53+
}
54+
55+
public void setAuthorId(String authorId) {
56+
this.authorId = authorId;
57+
}
58+
59+
public String getUrl() {
60+
return url;
61+
}
62+
63+
public void setUrl(String url) {
64+
this.url = url;
65+
}
66+
67+
public double getTime() {
68+
return time;
69+
}
70+
71+
public void setTime(double time) {
72+
this.time = time;
73+
}
74+
75+
public CinemaRoom(int id, String name, String pass, String authorId) {
76+
this.id = id;
77+
this.name = name;
78+
this.sockets = new CopyOnWriteArraySet<>();
79+
this.pass = pass;
80+
this.authorId = authorId;
81+
}
82+
}

src/main/java/com/danbai/ys/entity/Tvb.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
package com.danbai.ys.entity;
23

34
import javax.persistence.GeneratedValue;
@@ -86,4 +87,4 @@ public String getDmid() {
8687
public void setDmid(String dmid) {
8788
this.dmid = dmid;
8889
}
89-
}
90+
}

0 commit comments

Comments
 (0)