├── src ├── react-app-env.d.ts ├── global.d.ts ├── App.tsx ├── setupTests.ts ├── api │ └── api.ts ├── reportWebVitals.ts ├── index.tsx ├── Video.less └── Video.tsx ├── public ├── favicon.ico ├── logo192.png ├── logo512.png ├── robots.txt ├── manifest.json └── index.html ├── .gitignore ├── tsconfig.json ├── .github └── workflows │ └── main.yml ├── package.json ├── craco.config.js └── README.md /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockmood/react-video/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockmood/react-video/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockmood/react-video/HEAD/public/logo512.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/global.d.ts: -------------------------------------------------------------------------------- 1 | declare global{ 2 | interface Window { 3 | wx:any; 4 | } 5 | } 6 | 7 | export {} -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Video from './Video'; 3 | 4 | function App() { 5 | return ( 6 |
7 |
9 | ); 10 | } 11 | 12 | export default App; 13 | -------------------------------------------------------------------------------- /src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /src/api/api.ts: -------------------------------------------------------------------------------- 1 | var jxapis = { 2 | "全民解析":"https://jx.aidouer.net/?url=", 3 | 'go': "https://jx.playerjy.com?url=", 4 | "8090g": "https://www.8090g.cn/?url=", 5 | "8090g2": "https://www.8090g.cn/jiexi/?url=", 6 | "ckmov": "https://www.ckmov.vip/api.php?url=", 7 | "m3u8": "https://jx.m3u8.tv/jiexi/?url=", 8 | } 9 | 10 | export default jxapis; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './App'; 4 | import reportWebVitals from './reportWebVitals'; 5 | 6 | const root = ReactDOM.createRoot( 7 | document.getElementById('root') as HTMLElement 8 | ); 9 | root.render( 10 | 11 | 12 | 13 | ); 14 | 15 | // If you want to start measuring performance in your app, pass a function 16 | // to log results (for example: reportWebVitals(console.log)) 17 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 18 | reportWebVitals(); 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /src/Video.less: -------------------------------------------------------------------------------- 1 | .videoBox{ 2 | box-sizing: border-box; 3 | padding: 10px; 4 | .tooltip{ 5 | margin-bottom: 10px; 6 | } 7 | .videoHeader{ 8 | display: flex; 9 | &:extend(.videoBox .tooltip); 10 | } 11 | } 12 | 13 | .videoPlay{ 14 | margin-top: 10px; 15 | width: 100%; 16 | iframe{ 17 | width: 100%; 18 | height: 500px; 19 | background: #000; 20 | } 21 | .emptyBox{ 22 | width: 100%; 23 | height: 500px; 24 | background: #000; 25 | color: #fff; 26 | display: grid; 27 | place-items: center; 28 | } 29 | @media screen and (max-width: 1180px) { 30 | iframe{ 31 | height: 300px; 32 | } 33 | .emptyBox{ 34 | height: 300px; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build and Deploy 2 | on: [push] 3 | permissions: 4 | contents: write 5 | jobs: 6 | build-and-deploy: 7 | concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 🛎️ 11 | uses: actions/checkout@v3 12 | 13 | - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. 14 | run: | 15 | yarn install 16 | yarn build 17 | 18 | - name: Deploy 🚀 19 | uses: JamesIves/github-pages-deploy-action@v4.3.3 20 | with: 21 | branch: gh-pages # The branch the action should deploy to. 22 | folder: build # The folder the action should deploy. 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-video", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@craco/craco": "^6.4.3", 7 | "@testing-library/jest-dom": "^5.14.1", 8 | "@testing-library/react": "^13.0.0", 9 | "@testing-library/user-event": "^13.2.1", 10 | "@types/jest": "^27.0.1", 11 | "@types/node": "^16.7.13", 12 | "@types/react": "^18.0.0", 13 | "@types/react-dom": "^18.0.0", 14 | "antd": "^4.21.3", 15 | "craco-antd": "^2.0.0", 16 | "craco-less": "^2.0.0", 17 | "react": "^18.2.0", 18 | "react-dom": "^18.2.0", 19 | "react-fast-marquee": "^1.3.2", 20 | "react-scripts": "5.0.1", 21 | "typescript": "^4.4.2", 22 | "web-vitals": "^2.1.0", 23 | "weixin-sdk-js": "^1.0.11" 24 | }, 25 | "scripts": { 26 | "start": "craco start", 27 | "build": "craco build", 28 | "test": "react-scripts test", 29 | "eject": "react-scripts eject" 30 | }, 31 | "eslintConfig": { 32 | "extends": [ 33 | "react-app", 34 | "react-app/jest" 35 | ] 36 | }, 37 | "browserslist": { 38 | "production": [ 39 | ">0.2%", 40 | "not dead", 41 | "not op_mini all" 42 | ], 43 | "development": [ 44 | "last 1 chrome version", 45 | "last 1 firefox version", 46 | "last 1 safari version" 47 | ] 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /craco.config.js: -------------------------------------------------------------------------------- 1 | const CracoAntDesignPlugin = require("craco-antd"); 2 | const CracoLessPlugin = require("craco-less"); 3 | const { loaderByName } = require("@craco/craco"); 4 | 5 | module.exports = { 6 | webpack: { 7 | configure: (webpackConfig, { env, paths }) => { 8 | if(process.env.NODE_ENV !== 'development'){ 9 | webpackConfig.output.publicPath = './' 10 | } 11 | return webpackConfig; 12 | } 13 | }, 14 | plugins: [ 15 | { plugin: CracoAntDesignPlugin }, 16 | { 17 | plugin: CracoLessPlugin, 18 | options: { 19 | modifyLessRule(lessRule, context) { 20 | // You have to exclude these file suffixes first, 21 | // if you want to modify the less module's suffix 22 | lessRule.exclude = /\.m\.less$/; 23 | return lessRule; 24 | }, 25 | modifyLessModuleRule(lessModuleRule, context) { 26 | // Configure the file suffix 27 | lessModuleRule.test = /\.m\.less$/; 28 | 29 | // Configure the generated local ident name. 30 | const cssLoader = lessModuleRule.use.find(loaderByName("css-loader")); 31 | cssLoader.options.modules = { 32 | localIdentName: "[local]_[hash:base64:5]", 33 | }; 34 | 35 | return lessModuleRule; 36 | } 37 | } 38 | } 39 | ], 40 | }; -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 16 | 17 | 26 | 8566视频解析 - 全网VIP会员视频免费观看 27 | 28 | 29 | 30 |
31 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `yarn start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `yarn test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `yarn build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `yarn eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | -------------------------------------------------------------------------------- /src/Video.tsx: -------------------------------------------------------------------------------- 1 | import React, { useCallback, useEffect, useState } from 'react'; 2 | import { Button, Input, message, Alert, Select } from 'antd'; 3 | 4 | import Marquee from 'react-fast-marquee'; 5 | 6 | import API from './api/api'; 7 | 8 | import './Video.less'; 9 | 10 | const { Option } = Select; 11 | 12 | const Video = () => { 13 | 14 | const [ inputValue, setInputValue] = useState(''); 15 | const [ playUrl, setPlayUrl ] = useState(''); 16 | const [ playBtn, setPlayBtn ] = useState(false); 17 | const [ nodeValue, setNodeValue ] = useState(API['m3u8']); 18 | 19 | useEffect(()=>{ 20 | 21 | },[]) 22 | 23 | const changeInput = useCallback((event: React.ChangeEvent)=>{ 24 | setInputValue(event.target.value.trim()) 25 | },[]) 26 | 27 | const onChangeSelect = (event:React.ChangeEvent) => { 28 | setNodeValue(event) 29 | } 30 | 31 | const play = () => { 32 | if(!inputValue.length){ 33 | message.error('请输入要播放的链接地址') 34 | return 35 | } 36 | if(!/^(http:\/\/|https:\/\/).*/g.test(inputValue)){ 37 | message.error('请输入要正确的的页面地址') 38 | return 39 | } 40 | setPlayUrl(nodeValue + inputValue) 41 | setPlayBtn(true) 42 | } 43 | 44 | const randomHex = () => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")}`; 45 | 46 | 47 | const renderEmpty = () => { 48 | if(!playBtn){ 49 | return <> 50 |
51 | 部分视频解析时间较长,请耐心等待。 52 |
53 | 54 | } 55 | return