Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add browsing scanning feature through mitmproxy #145

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8d7136e
Release v2.5.3
StefanLobbenmeier Sep 25, 2023
05732f7
Update package-lock.json
StefanLobbenmeier Sep 25, 2023
a612360
fixed percentage bug (closes #58, closes #70)
Cl00e9ment Sep 25, 2023
a1ae56c
fixed #50
Cl00e9ment Sep 25, 2023
071815b
forgot to remove debug print
Cl00e9ment Sep 25, 2023
367d2b0
fixed #64
Cl00e9ment Sep 25, 2023
2f8c3eb
fixed lint
Cl00e9ment Sep 25, 2023
da8c13f
better handling of completion percentage and logging
Cl00e9ment Sep 26, 2023
0ba6c8c
added ozone flag in package.jon
Cl00e9ment Sep 26, 2023
de645bc
fixed utf8 unescape regex
Cl00e9ment Sep 26, 2023
7a08e9f
fixed small regression: audio download percentage not showing
Cl00e9ment Sep 26, 2023
c131f03
cleaned a bit version check code + fixed unhandled promise rejection …
Cl00e9ment Sep 26, 2023
516dd0b
fixed tests
Cl00e9ment Sep 26, 2023
c838a28
removed now deprecated rmdir+recursive
Cl00e9ment Sep 26, 2023
dd67af5
DoneAction: add hibernate when done action.
AnessZurba Dec 9, 2022
f5988ea
renderer: focus input field on start.
Deasonfun Apr 27, 2022
b373a72
Update modules/DoneAction.js
StefanLobbenmeier Oct 8, 2023
67554eb
Release v2.5.4
StefanLobbenmeier Oct 8, 2023
4a4773d
Add information on how to support the project (Fixes #72)
StefanLobbenmeier Oct 8, 2023
da94e94
fixing indexing bug (#100)
mnasty Apr 9, 2024
9c63ba0
Release v2.5.5
StefanLobbenmeier Aug 31, 2024
c79d278
add network scanning feature
mp3butcher Oct 1, 2024
2fd6657
enable live stream support
mp3butcher Oct 22, 2024
840af20
add dash detection
mp3butcher Oct 22, 2024
38d8dc2
bump version
mp3butcher Oct 22, 2024
0988d6c
Upgrade deprecated macos-11 action to macos-12
mp3butcher Oct 27, 2024
0bd083c
Update send_traffic_to_videodownloader.py
mp3butcher Oct 27, 2024
99d3c65
add dmg-license dependency
mp3butcher Oct 27, 2024
ba531eb
fix testing ,playlist and refactorr queries
mp3butcher Nov 18, 2024
1360b2c
fix #86 and #115
mp3butcher Nov 18, 2024
72043fb
bump version
mp3butcher Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Build artifacts to link to release

on:
workflow_dispatch:
inputs:
version:
description: 'Version number'
required: true
push:
tags:
- '*'
Expand All @@ -9,7 +14,7 @@ jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: '20'
Expand All @@ -28,7 +33,7 @@ jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: '20'
Expand All @@ -43,7 +48,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-mac:
runs-on: macos-11
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-winget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
shell: cmd
run: |
curl https://aka.ms/wingetcreate/latest -L --output wingetcreate.exe
wingetcreate.exe update StefanLobbenmeier.youtube-dl-gui -s true -u https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/download/v%APP_VERSION%/Open-Video-Downloader-Setup-%APP_VERSION%.exe -v %APP_VERSION% -t %WINGET_TOKEN%
wingetcreate.exe update mp3butcher.youtube-dl-gui -s true -u https://github.com/mp3butcher/youtube-dl-gui/releases/download/v%APP_VERSION%/Open-Video-Downloader-Setup-%APP_VERSION%.exe -v %APP_VERSION% -t %WINGET_TOKEN%
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<img src="https://raw.githubusercontent.com/StefanLobbenmeier/youtube-dl-gui/v2.0.0/renderer/img/icon.png" alt="logo" align="left" height="100"/>

# Open Video Downloader (youtube-dl-gui)
[![version badge](https://img.shields.io/github/v/release/StefanLobbenmeier/youtube-dl-gui?label=latest-release)](https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/latest)
[![version badge](https://img.shields.io/github/v/release/mp3butcher/youtube-dl-gui?label=latest-release)](https://github.com/mp3butcher/youtube-dl-gui/releases/latest)
[![license](https://img.shields.io/github/license/StefanLobbenmeier/youtube-dl-gui)](https://github.com/StefanLobbenmeier/youtube-dl-gui/blob/master/LICENSE)
[![coverage badge](https://img.shields.io/codecov/c/github/StefanLobbenmeier/youtube-dl-gui)](https://app.codecov.io/gh/StefanLobbenmeier/youtube-dl-gui)
[![downloads](https://img.shields.io/github/downloads/StefanLobbenmeier/youtube-dl-gui/total)](https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/latest)
[![CI badge](https://img.shields.io/github/actions/workflow/status/StefanLobbenmeier/youtube-dl-gui/continuous-integration.yaml)](https://github.com/StefanLobbenmeier/youtube-dl-gui/actions)
[![coverage badge](https://img.shields.io/codecov/c/github/mp3butcher/youtube-dl-gui)](https://app.codecov.io/gh/mp3butcher/youtube-dl-gui)
[![downloads](https://img.shields.io/github/downloads/mp3butcher/youtube-dl-gui/total)](https://github.com/mp3butcher/youtube-dl-gui/releases/latest)
[![CI badge](https://img.shields.io/github/actions/workflow/status/mp3butcher/youtube-dl-gui/continuous-integration.yaml)](https://github.com/mp3butcher/youtube-dl-gui/actions)

https://github.com/StefanLobbenmeier/youtube-dl-gui

A cross-platform GUI for youtube-dl made in Electron and node.js

based on https://github.com/StefanLobbenmeier/youtube-dl-gui but adding a traffic scanning feature (using mitmproxy)

- I] When scanner activated the first time don't forget to install mitmproxy authority certificate (cf image)
![Screenshot from 2024-10-07 16-37-04](https://github.com/user-attachments/assets/3fb3bb86-d5a8-44d8-ab8e-05429bd8fb4c)
- II] I recommend to use browser proxy switcher extension such as [this extension](https://chromewebstore.google.com/detail/proxy-switcher/iejkjpdckomcjdhmkemlfdapjodcpgih?hl=fr) to easily enable/disable proxy usage while browsing (set it up proxy=localhost and port=15930)
![Screenshot from 2024-10-07 16-43-32](https://github.com/user-attachments/assets/a4650d10-a2f0-4059-b72c-9a241e550338)
- III] Browse to a streaming content and let the scanner capture the video

### Features:
- Download from all kind of platforms: YouTube, vimeo, twitter & many more
Expand All @@ -20,25 +26,32 @@ A cross-platform GUI for youtube-dl made in Electron and node.js
- Multithreaded, up to 32 videos can be downloaded synchronously
- Shows how much size the download will use up on your system
- The app automatically keeps ytdl up-to-date
- The app include a network scanner through a binding with mitmproxy

Be sure to check out [a demo gif of the application](#Demo-gif)!

## How to use
1. Download the [applicable installer or executable](https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/latest) for your system.
1. Download the [applicable installer or executable](https://github.com/mp3butcher/youtube-dl-gui/releases/latest) for your system.
2. If you are on windows, make sure that the [Microsoft Visual C++ 2010 Redistributable Package (x86)](https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe) is installed.
3. Paste a link into the box up top.
4. Wait for the app to gather all required metadata.
5. Press download, and the video(s) will get downloaded to your downloads folder.

Want to know more about the features this app offers? Head over to the [wiki](https://github.com/StefanLobbenmeier/youtube-dl-gui/wiki/).

## Supporting the project
I appreciate any help. That may include:
- testing and raising issues if you encounter any
- contributing via a pull request
- donating to the project ([ko-fi](https://ko-fi.com/stefanlobbenmeier))

## Something is not working!
Please see if the answer is in the [frequently answered questions](https://github.com/StefanLobbenmeier/youtube-dl-gui/wiki/FAQ) or in the [wiki](https://github.com/StefanLobbenmeier/youtube-dl-gui/wiki/).

Still haven't found your answer? [Open up an issue](https://github.com/StefanLobbenmeier/youtube-dl-gui/issues), and describe the problem you're facing.

## Building from source
First, clone the repository using `git clone https://github.com/StefanLobbenmeier/youtube-dl-gui.git`.
First, clone the repository using `git clone https://github.com/mp3butcher/youtube-dl-gui.git`.

Then navigate to the directory and install the npm modules by executing: `npm install`.

Expand All @@ -49,7 +62,6 @@ Please be aware that this app is only tested on windows, linux and macOS. If you
## Planned features
- Select individual audio and video codecs (advanced mode)
- List all audio qualities
- Support for downloading livestreams

Feel free to [request a new feature](https://github.com/StefanLobbenmeier/youtube-dl-gui/issues).

Expand Down
100 changes: 100 additions & 0 deletions binaries/send_traffic_to_videodownloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import asyncio
import base64
import socket, threading
import queue
import time

from mitmproxy import ctx
from mitmproxy import http

LISTENING_PORT = 12000

# Queue to hold requests data to be sent
data_queue = queue.Queue(maxsize=15)

def sendTrafficLoop(trafficLoggerAddon):
data=''
deadguard=0
try:
while data=='':
try:
data=trafficLoggerAddon.socket_connection.recv(1)
print(data)
trafficLoggerAddon.socket_connection.close()
trafficLoggerAddon.socket_instance.close()
ctx.master.shutdown()
except:
pass
if data_queue.qsize()>0:
msg = data_queue.get()
if msg is not None:
trafficLoggerAddon.socket_connection.send(msg.encode())
else:
deadguard=deadguard+1
if deadguard>10000000:
#Dirty connection test to exit even if OpenVideoDownloader prematurally die
trafficLoggerAddon.socket_connection.send('testconnection'.encode())
deadguard=0
except:
trafficLoggerAddon.socket_connection.close()
trafficLoggerAddon.socket_instance.close()
ctx.master.shutdown()
trafficLoggerAddon.socket_connection.close()
trafficLoggerAddon.socket_instance.close()
ctx.master.shutdown()

class TrafficLogger:
def __init__(self):
self.socket_instance = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#self.socket_instance.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket_instance.bind(('127.0.0.1', LISTENING_PORT))
self.socket_instance.listen(1) #limit to one client
print('Proxy traffic server running on port 12000: Waiting for OpenVideoDownloader')
# Accept client connection
self.socket_connection, self.address = self.socket_instance.accept()
self.socket_connection.setblocking(False)
print('OpenVideoDownloader connected: Ready to send traffic')

# Launch a thread to send traffic
thread = threading.Thread(target=sendTrafficLoop, args=([self]))
thread.start()


def request(self, flow):
self.checkflow(flow, False)

def response(self, flow):
self.checkflow(flow, True)
return

def checkflow(self,flow,isrep):
url='"' + flow.request.url+ '"'
headers="["
for k, v in flow.request.headers.items():
if k!='If-Range': #TODO: Headers should be filtered in OpenVideoDownloader instead of here
headers=headers+'{"k":"'+k+'"'+',"v":'+'"'+v.replace('"','\\"')+'"'+'},'
if headers=="[":
headers=headers+"]"
else:
headers=headers[:-1]+"]"
rheaders="[]"
if isrep:
rheaders="["
for k, v in flow.response.headers.items():
rheaders=rheaders+'{"k":"'+k+'"'+',"v":'+'"'+v.replace('"','\\"')+'"'+'},'
if rheaders=="[":
rheaders=rheaders+"]"
else:
rheaders=rheaders[:-1]+"]"
data=""
if isrep:
#Don't send large response
if len(flow.response.text)<20000000:
try:
data=base64.b64encode(flow.response.content[:10000]).decode("ascii")
except:
data=""
msg='{"url":'+url+',"headers":'+headers+',"rheaders":'+rheaders+',"response":"'+data+'"}'
data_queue.put(msg)

addons = [TrafficLogger()]
Loading