Comments (8)
Oh, I see. For /watch
, the video id is in the querystring, but for /embed
it's in the path, so my check wouldn't work.
Instead of trying to guess whether or not it's a youtube URL ourselves, we should just ask ytdl. And, come to think of it, we could drop the first part and make this page work for other domains like youtu.be and m.youtube.com:
Can you try this and let me know if it works?
- if (hostname === "www.youtube.com" && (pathname === "/watch" || pathname === "/embed")) {
+ if (ytdl.validateURL(data.url)) {
from node-unblocker.
Another small bug was found
https://..**/proxy/https://www.youtube.com/watch?v=XGxIE1hr0w4
In areas where youtube cannot be accessed, the cover image cannot be displayed. Here is the webpage source code:
from node-unblocker.
Aah, good points. For the first one, you might just need to change this line to include /embed urls:
- if (hostname === "www.youtube.com" && pathname === "/watch") {
+ if (hostname === "www.youtube.com" && (pathname === "/watch" || pathname === "/embed")) {
For the second one, I think you need to add /proxy/
to the start of the poster url here:
- <video controls poster="${thumb.url}" style="width: 100%">
+ <video controls poster="/proxy/${thumb.url}" style="width: 100%">
Also, I think we should add poster=
to this regex, although I don't think it affects the youtube page
node-unblocker/lib/url-prefixer.js
Line 24 in 1f5bdf3
I don't have time to test these out right now, but that's my best guess as to the fixes; feel free to try them out if you have the time.
from node-unblocker.
I went ahead and incorporated the changes so that everyone else will get it going forward. Thanks for testing things for me!
from node-unblocker.
Thank you very much for helping me in your busy schedule. I have done what you told me and the cover image problem has been solved.
But the first problem still exists. The corresponding source code has been changed to: “if (hostname === "www.youtube.com" && (pathname === "/watch" || pathname === "/embed")) {”
But when proxying a URL in the format of https://www.youtube.com/embed/XGxIE1hr0w4, it cannot be played. Here are the test results:
![205700](https://private-user-images.githubusercontent.com/43735033/337520224-75835bcd-8a15-4521-aca4-3d6dca0ad6ac.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMjE3MzYsIm5iZiI6MTcyNDAyMTQzNiwicGF0aCI6Ii80MzczNTAzMy8zMzc1MjAyMjQtNzU4MzViY2QtOGExNS00NTIxLWFjYTQtM2Q2ZGNhMGFkNmFjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDIyNTAzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE2YzNiYTVjMWFhY2U1NTVhZmZhMjgzMGU3YjVlZWVlMTZhNTg1N2UzYzY5ODFjMjAxZmE1ZmZiMzA5YmRkMzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lWRX777afRMWsb2qxH-afnoEsQWez650aQpSjbdmFtU)
Thank you again! !
from node-unblocker.
In addition, there is no error output on the console。
from node-unblocker.
Oh, I see. For
/watch
, the video id is in the querystring, but for/embed
it's in the path, so my check wouldn't work.Instead of trying to guess whether or not it's a youtube URL ourselves, we should just ask ytdl. And, come to think of it, we could drop the first part and make this page work for other domains like youtu.be and m.youtube.com:
Can you try this and let me know if it works?
- if (hostname === "www.youtube.com" && (pathname === "/watch" || pathname === "/embed")) { + if (ytdl.validateURL(data.url)) {
Really Great!!! Works perfectly!!!
This problem is perfectly solved!!
Thank you again!!
from node-unblocker.
Thank you so much for everything you do!!
^_^
from node-unblocker.
Related Issues (20)
- Weird Redirect when deploying with openode.io HOT 2
- Error HOT 1
- Discord isn't working. HOT 5
- Discord link HOT 2
- Next.js support HOT 3
- maleik2
- JustAguy HOT 1
- In Search Of A Proxy HOT 2
- Setting a static URL without typing it after the prefix HOT 7
- Google safe-browsing flags unblocker as phishing
- Proxy not working with Nike.com and Cloudflare HOT 2
- My administrator's website still blocks it even when I use unblockernode
- Z_DATA_ERROR HOT 7
- use node-unblocker in client sveltekit without node js HOT 1
- how to use node-unblocker with https-proxy-agent HOT 1
- sometime error and stuck when use in docker HOT 3
- URL PATH - [feature] HOT 6
- how to add ads in unblocked website HOT 3
- how to bypass cloudflare Human Veriication HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-unblocker.